我有一个SQL选择:
SELECT employee.name, employee.surname, department.name FROM employee INNER JOIN deparment
ON employee.id_department=department.id WHERE department.name = 'security'
但我想选择只有5条记录。如果我可以使用SQL工具执行此操作?
如果我选择> = 5条记录(超过5条记录)?
答案 0 :(得分:4)
这是SQL
SELECT employee.name, employee.surname, department.name
FROM employee INNER JOIN deparment
ON employee.id_department=department.id
WHERE department.name = 'security'
LIMIT 5;
了解有关LIMIT
的更多信息我相信> = 5条记录意味着留下前5条记录并获得另外5条记录。
SELECT employee.name, employee.surname, department.name
FROM employee INNER JOIN deparment
ON employee.id_department=department.id
WHERE department.name = 'security'
LIMIT 5,5;
答案 1 :(得分:2)
SELECT employee.name, employee.surname, department.name FROM employee INNER JOIN deparment
ON employee.id_department=department.id WHERE department.name = 'security'
limit 5;
答案 2 :(得分:1)
SELECT employee.name
, employee.surname
, department.name
FROM employee
INNER JOIN deparment
ON employee.id_department=department.id
WHERE department.name = 'security'
LIMIT 5 , 5 ;
答案 3 :(得分:1)
SELECT employee.name, employee.surname, department.name FROM employee INNER JOIN deparment
ON employee.id_department=department.id WHERE department.name = 'security'
LIMIT 5;
答案 4 :(得分:1)
SELECT employee.name
,employee.surname
,dept.name
来自员工INNER JOIN部门作为债务开启employee.id_department
= dept.id
WHERE department.name
=&#39 ;安全'限制5,5;