`

20170909学习sql笔记

 
阅读更多
http://ybds8.s602.xrea.com/
select * from employees; select * from salaries where emp_no in (select emp_no from employees where gender='M' ) Create Database YGGL create table Employees ( EmployeeID char(6) not null, Name char(10) not null, Education char(4) not null, Birthday datetime not null, Sex char(2) not null, WorkYear tinyint(1), Address varchar(20), PhoneNumber char(12), DepartmentID char(3) not null, PRIMARY KEY (EmployeeID) )engine=InnoDB; create table Employees1 ( EmployeeID char(6) not null, Name char(10) not null, Education char(4) not null, Birthday datetime not null, Sex char(2) not null, WorkYear tinyint(1), Address varchar(20), PhoneNumber char(12), DepartmentID char(3) not null, PRIMARY KEY (EmployeeID) )engine=InnoDB; Alter table employees1 alter Sex set default 1, drop column Address; create table Deparments ( departmentID char(3) not null, departmentName char(20) not null, note text(16), primary key (departmentID) ) create table Salary ( employeeID char(6) not null, Income float(8) not null, Outcome float(8) not null, primary key(employeeID) ) insert into employees values ('000001', '王林', '大专', '1966-01-23', '1' ,'8', '中山路32-1-508' ,'83355668' ,'2') insert into employees values ('010008','伍容华','本科','1976-03-28','1','3','北京东路100-2','833211321','1'), ('020010','王向荣','硕士','1982-12-09','1','2','四牌路10-0-108','83792361','1') select * from employees
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics