Answers for "sql server select + 1"

SQL
0

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.
Posted by: Guest on April-10-2020
0

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.
Posted by: Guest on August-15-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language