Questions tagged [select]

Select is a common keyword used to query data. 'select()' is also a programming function for triggering code based on file handle or other system activity. Do not use this tag for questions related to: HTML

In query languages (SQL, …)

SELECT is a statement in query languages, like SQL or SPARQL. It returns a result set of records from one or more tables.

SELECT queries require two essential parts. The first part is the WHAT, which determines what we want SQL to go and fetch. The second part of any SELECT command is the FROM WHERE. It identifies where to fetch the data from, which may be from a SQL table, a SQL view, or some other SQL data object.



<select> is also an HTML user interface element for choosing one or more option(s) from a finite collection of elements. Do not use this tag for this purpose, use instead.


select is a keyword that can be used for queries on various data sources that implement specific features, directly from language itself. Do not use this tag for such questions, use instead.

In C and C++

select() is an important system call used by C and C++ programs and libraries that avoids busy waiting for network activity and other I/O to complete.

In Perl

In Perl 5, select() has two different uses. When called with four parameters, it calls the same syscall as C and C++. In this form it has limited portability. Otherwise it is called with one or no parameters and sets or gets current default filehandle for output. The filehandle is used e.g. by print if no other specified. Special variables like $| relate to it, too. This second form is perfectly portable.

In Perl 6 it has been completely dropped.

In Go

The select statement lets a goroutine wait on multiple channel operations. A select blocks until one of its cases can run, then it executes that case.

38465 questions
24 answers

Selecting multiple columns in a Pandas dataframe

How do I select columns a and b from df, and save them into a new dataframe df1? index a b c 1 2 3 4 2 3 4 5 Unsuccessful attempt: df1 = df['a':'b'] df1 = df.ix[:, 'a':'b']
  • 22,521
  • 18
  • 61
  • 103
29 answers

SQL Update from One Table to Another Based on a ID Match

I have a database with account numbers and card numbers. I match these to a file to update any card numbers to the account number so that I am only working with account numbers. I created a view linking the table to the account/card database to…
17 answers

jQuery get value of select onChange

I was under the impression that I could get the value of a select input by doing this $(this).val(); and applying the onchange parameter to the select field. It would appear it only works if I reference the ID. How do I do it using this.
  • 19,801
  • 35
  • 121
  • 199
16 answers

SQL SELECT WHERE field contains words

I need a select which would return results like this: SELECT * FROM MyTable WHERE Column1 CONTAINS 'word1 word2 word3' And I need all results, i.e. this includes strings with 'word2 word3 word1' or 'word1 word3 word2' or any other combination of…
  • 13,941
  • 20
  • 54
  • 110
13 answers

MySQL - UPDATE query based on SELECT Query

I need to check (from the same table) if there is an association between two events based on date-time. One set of data will contain the ending date-time of certain events and the other set of data will contain the starting date-time for other…
John M
  • 14,338
  • 29
  • 91
  • 143
25 answers

How to get a list of column names on Sqlite3 database?

I want to migrate my iPhone app to a new database version. Since I don't have some version saved, I need to check if certain column names exist. This Stackoverflow entry suggests doing the select SELECT sql FROM sqlite_master WHERE tbl_name =…
  • 6,221
  • 5
  • 22
  • 18
6 answers

Create a temporary table in a SELECT statement without a separate CREATE TABLE

Is it possible to create a temporary (session only) table from a select statement without using a create table statement and specifying each column type? I know derived tables are capable of this, but those are super-temporary (statement-only) and I…
700 Software
  • 85,281
  • 83
  • 234
  • 341
14 answers

How to select all columns except one in pandas?

I have a dataframe that look like this: a b c d 0 0.418762 0.042369 0.869203 0.972314 1 0.991058 0.510228 0.594784 0.534366 2 0.407472 0.259811 0.396664 0.894202 3 0.726168 0.139531 0.324932 …
markov zain
  • 11,987
  • 13
  • 35
  • 39
19 answers

Select columns from result set of stored procedure

I have a stored procedure that returns 80 columns, and 300 rows. I want to write a select that gets 2 of those columns. Something like SELECT col1, col2 FROM EXEC MyStoredProc 'param1', 'param2' When I used the above syntax I get the error:…
  • 5,960
  • 4
  • 29
  • 32
19 answers

MySQL: Select DISTINCT / UNIQUE, but return all columns?

SELECT DISTINCT field1, field2, field3, ...... FROM table; I am trying to accomplish the following SQL statement, but I want it to return all columns. Is this possible? Something like this: SELECT DISTINCT field1, * FROM table;
  • 76,198
  • 92
  • 293
  • 442
13 answers

SQL join: selecting the last records in a one-to-many relationship

Suppose I have a table of customers and a table of purchases. Each purchase belongs to one customer. I want to get a list of all customers along with their last purchase in one SELECT statement. What is the best practice? Any advice on building…
  • 7,647
  • 7
  • 32
  • 42
5 answers

Select objects based on value of variable in object using jq

I have the following json file: { "FOO": { "name": "Donald", "location": "Stockholm" }, "BAR": { "name": "Walt", "location": "Stockholm" }, "BAZ": { "name": "Jack", "location":…
  • 12,445
  • 4
  • 21
  • 18
6 answers

SQL query return data from multiple tables

I would like to know the following: how to get data from multiple tables in my database? what types of methods are there to do this? what are joins and unions and how are they different from one another? When should I use each one compared to the…
  • 33,228
  • 16
  • 67
  • 80
33 answers

Select all columns except one in MySQL?

I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this? EDIT: There are 53 columns in this table (NOT MY DESIGN)
Tom Grochowicz
  • 5,385
  • 3
  • 21
  • 18
2 3
99 100