Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL WHERE column = everything

Tags:

sql

mysql

Is SQL able to do something along the lines of this: SELECT * FROM table WHERE column = everything

like image 568
Majo0od Avatar asked May 30 '12 22:05

Majo0od


People also ask

How do I get all column data in SQL?

SELECT statements SELECT column1, column2 FROM table1, table2 WHERE column2='value'; In the above SQL statement: The SELECT clause specifies one or more columns to be retrieved; to specify multiple columns, use a comma and a space between column names. To retrieve all columns, use the wild card * (an asterisk).

Where value is any SQL?

SQL WHERE with ANY, ALLANY and ALL operators are used with WHERE or HAVING. ANY and ALL operate on subqueries that return multiple values. ANY returns true if any of the subquery values meet the condition. ALL returns true if all of the subquery values meet the condition.

What is all () in SQL?

ALL means that the condition will be true only if the operation is true for all values in the range.


1 Answers

For anyone who NEEDS the column name in the query for whatever reason (probably dynamic SQL), a nice alternative would be SELECT * FROM table WHERE column = column

This is very similar to WHERE 1=1, however it includes the column name, which my solution required, and maybe a few others will require as well.

like image 51
DubDub Avatar answered Sep 28 '22 11:09

DubDub