select 1 from orders
select 1 from table will return the constant 1 for every row of the table. It's useful when you want to cheaply determine if record matches your where clause and/or join.
select 1 from orders
select 1 from table will return the constant 1 for every row of the table. It's useful when you want to cheaply determine if record matches your where clause and/or join.
SELECT 1 from table
select * from StudentTable;
-- output :
+------+-------+
| id | name |
+------+-------+
| 1 | John |
| 2 | Carol |
| 3 | Smith |
| 4 | Bob |
+------+-------+
4 rows in set (0.00 sec)
-- EXAMPLE OF SELECT 1
select 1 from StudentTable;
-- output :
+---+
| 1 |
+---+
| 1 |
| 1 |
| 1 |
| 1 |
+---+
4 rows in set (0.00 sec)
-- The above returns 1 four times for 4 records,
-- and if we had 5 records then the above query
-- would have returned 1 five times.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us