MYSQL First:
-Basically, first are used to display the record of top most row of the table.
What be use to do this?
We use
LIMIT to do this
Syntax:
SELECT * FROM table_name
LIMIT index;
-Where,'index' is any integer number which is the number of row you want to display.
Display all record of table employee:
SELECT * FROM employee;
| emp_id |
emp_name |
department |
emp_salary |
| 1 |
Aman |
D1 |
34000 |
| 2 |
Ram |
D2 |
43000 |
| 3 |
Ramesh |
D1 |
20000 |
| 4 |
John |
D3 |
65000 |
| 5 |
Sita |
D1 |
10000 |
| 6 |
Dinesh |
D2 |
15000 |
Now display top first row of table:
SELECT * FROM employee LIMIT 1;
| emp_id |
emp_name |
department |
emp_salary |
| 1 |
Aman |
D1 |
34000 |
Now Display the top two row:
SELECT * FROM employee LIMIT 2;
| emp_id |
emp_name |
department |
emp_salary |
| 1 |
Aman |
D1 |
34000 |
| 2 |
Ram |
D2 |
43000 |