标签:mysql tle mysq beauty 别名 使用 dep friend name
#案例:查询女神名和对应的男神名SELECT
NAME,boyName
FROM
boys,beauty
WHERE
beauty.boyfriend_id=boys.id;
USE myemployees;
#案例:查询employees表的员工名和对应的departments表的部门名,限定字段名相同
SELECT
last_name,department_name
FROM
departments,employees
WHERE
employees.department_id=departments.department_id;
#案例:查询员工名、工种号、工种名,限定字段名和查询字段名相同
SELECT
last_name,employees.job_id,job_title
FROM
employees,jobs
WHERE
employees.job_id=jobs.job_id;
#为表取别名,如果取了别名,则就不能使用原始表名去限定
SELECT
last_name,e.job_id,job_title
FROM
employees AS e,jobs AS j
WHERE
e.job_id=j.job_id;
标签:mysql tle mysq beauty 别名 使用 dep friend name
原文地址:https://blog.51cto.com/14437184/2437255