Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql multi-table query equivalent join, alias for the table

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

# case: query the name of the goddess and the corresponding male name

SELECT NAME,boyNameFROM boys,beautyWHERE beauty.boyfriend_id=boys.id;USE myemployees

# case: the employee name of the query employees table and the department name of the corresponding departments table, and the qualified field name is the same

SELECT last_name,department_nameFROM departments,employeesWHERE employees.department_id=departments.department_id

# case: query employee name, job number, job name, qualified field name is the same as query field name

SELECT last_name,employees.job_id,job_titleFROM employees,jobsWHERE employees.job_id=jobs.job_id

# alias the table. If you choose an alias, you cannot use the original table name to qualify

SELECT last_name,e.job_id,job_titleFROM employees AS e,jobs AS jWHERE e.job_id=j.job_id

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report