SQL 一些常用的查询语句用法
SQL 中的聚合函数
SQL 中的子查询
SQL 使用实例
SELECT F_NAME , L_NAME
FROM EMPLOYEES
WHERE ADDRESS LIKE ‘%Elgin,IL%’;
SELECT F_NAME , L_NAME
FROM EMPLOYEES
WHERE B_DATE LIKE ‘197%’;
SELECT *
FROM EMPLOYEES
WHERE (SALARY BETWEEN 60000 AND 70000) AND DEP_ID = 5;
SELECT F_NAME, L_NAME, DEP_ID
FROM EMPLOYEES
ORDER BY DEP_ID;
SELECT F_NAME, L_NAME, DEP_ID
FROM EMPLOYEES
ORDER BY DEP_ID DESC, L_NAME DESC;
SELECT D.DEP_NAME , E.F_NAME, E.L_NAME
FROM EMPLOYEES as E, DEPARTMENTS as D
WHERE E.DEP_ID = D.DEPT_ID_DEP
ORDER BY D.DEP_NAME, E.L_NAME DESC;
SELECT DEP_ID, COUNT(*)
FROM EMPLOYEES
GROUP BY DEP_ID;
SELECT DEP_ID, COUNT(*), AVG(SALARY)
FROM EMPLOYEES
GROUP BY DEP_ID;
SELECT DEP_ID, COUNT(*) AS “NUM_EMPLOYEES”, AVG(SALARY) AS “AVG_SALARY”
FROM EMPLOYEES
GROUP BY DEP_ID;
SELECT DEP_ID, COUNT(*) AS “NUM_EMPLOYEES”, AVG(SALARY) AS “AVG_SALARY”
FROM EMPLOYEES
GROUP BY DEP_ID
ORDER BY AVG_SALARY;文章来源:https://www.toymoban.com/news/detail-696245.html
SELECT DEP_ID, COUNT() AS “NUM_EMPLOYEES”, AVG(SALARY) AS “AVG_SALARY”
FROM EMPLOYEES
GROUP BY DEP_ID
HAVING count() < 4
ORDER BY AVG_SALARY;文章来源地址https://www.toymoban.com/news/detail-696245.html
到了这里,关于SQL-basics的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!