首页 > TAG信息列表 > emp01

数据库——连接查询

创建副表CREATE TABLE emp01( eid INT PRIMARY KEY AUTO_INCREMENT, ename VARCHAR(10), esex CHAR(5), did INT, CONSTRAINT fk_emp01_dept01 FOREIGN KEY(did) REFERENCES dept01(did) -- 外键约束)新增数据INSERT INTO dept01(dname,mgr) VALUES('开发部','tom');INSE

9.24mysql

-- 子查询 把查询的结果当作另一个的查询条件-- 查询开发部所有员工信息SELECT * FROM emp01 WHERE did=(SELECT did FROM dept01 WHERE dname='开发部')-- 查询所有女员工所属部门名称SELECT dname FROM dept01 WHERE did=(SELECT did FROM emp01 WHERE esex='女')-- 查询男员工

9.22mysql学习

-- 默认值约束CREATE TABLE teacher( tid INT, tname VARCHAR(10), addr VARCHAR(30) DEFAULT '山东淄博')SELECT * FROM teacherINSERT INTO teacher VALUES(1,'李老师','山东济南')INSERT INTO teacher(tid,tname) VALUES(2,'张老师')INSERT INTO teac