#案例:查询女神名和对应的男神名
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;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。