DROP DATABASE mysql_shiyan;
。
cd /home/shiyanlou/Desktop
git clone https://github.com/shiyanlou/SQL4
#打开 MySQL 服务
sudo service mysql start
说明:sudo命令用来以其他身份来执行命令,预设的身份为root。
#使用 root 用户登录
mysql -u root
加载实验中的数据:
source /home/shiyan/Desktop/SQL4/MySQL-04-01.sql
连接查询:
SELECT id,name,people_num FROM employee , department WHERE employee.in_dpt = department.dpt_name ORDER BY id;
SELECT id,name,people_num FROM employee JOIN department ON employee.in_dpt = department.dpt_name ORDER BY id;