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.

Reference


In HTML

<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.


In .NET/LINQ

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
451
votes
3 answers

How to filter an array of objects based on values in an inner array with jq?

Given this input: [ { "Id": "cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b", "Names": [ "condescending_jones", "loving_hoover" ] }, { "Id":…
Abe Voelker
  • 30,124
  • 14
  • 81
  • 98
404
votes
10 answers

Why does the jquery change event not trigger when I set the value of a select using val()?

The logic in the change() event handler is not being run when the value is set by val(), but it does run when user selects a value with their mouse. Why is this? fields in HTML?
How can I check if a user has selected something from a doesn't support the new required attribute... do I have to use JavaScript then? Or is there something I’m missing? :/
Matt
  • 5,005
  • 10
  • 32
  • 39
295
votes
18 answers

jQuery: Best practice to populate drop down?

The example I see posted all of the time seems like it's suboptimal, because it involves concatenating strings, which seems so not jQuery. It usually looks like this: $.getJSON("/Admin/GetFolderList/", function(result) { for (var i = 0; i <…
Jeff Putz
  • 14,504
  • 11
  • 41
  • 52
291
votes
8 answers

How to get values from IGrouping

I have a question about IGrouping and the Select() method. Let's say I've got an IEnumerable> in this way: var groups = list.GroupBy(x => x.ID); where list is a List. And now I need to pass values of each IGrouping to…
Illia Ratkevych
  • 3,507
  • 4
  • 29
  • 35
283
votes
14 answers

MySQL: is a SELECT statement case sensitive?

Is a MySQL SELECT query case sensitive or case insensitive by default? And if not, what query would I have to send so that I can do something like the following? SELECT * FROM `table` WHERE `Value` = "iaresavage" Where in actuality, the real value…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
269
votes
5 answers

COUNT(*) vs. COUNT(1) vs. COUNT(pk): which is better?

I often find these three variants: SELECT COUNT(*) FROM Foo; SELECT COUNT(1) FROM Foo; SELECT COUNT(PrimaryKey) FROM Foo; As far as I can see, they all do the same thing, and I find myself using the three in my codebase. However, I don't like to do…
zneak
  • 134,922
  • 42
  • 253
  • 328
269
votes
5 answers

JOIN two SELECT statement results

Is it possible to join the results of 2 sql SELECT statements in one statement? I have a database of tasks where each record is a separate task, with deadlines (and a PALT, which is just an INT of days from start to deadline. Age is also an INT…
sylverfyre
  • 3,049
  • 3
  • 17
  • 15
262
votes
10 answers

SQL WHERE ID IN (id1, id2, ..., idn)

I need to write a query to retrieve a big list of ids. We do support many backends (MySQL, Firebird, SQLServer, Oracle, PostgreSQL ...) so I need to write a standard SQL. The size of the id set could be big, the query would be generated…
Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219