Javaweb-約束案例

wangyin0425發表於2024-09-07


create table emp( id int PRIMARY KEY AUTO_INCREMENT, ename varchar(50) not null unique, joindate date not null, salary double(7,2) not null, bonus double(7,2) default 0 );




insert into emp(id,ename,joindate,salary,bonus) values (1,'張三','1994-04-12',3000,800);






insert into emp(id,ename,joindate,salary,bonus) values(null,'王五','1991-03-19',2000,100);



insert into emp values(1,'李四','1996-01-19',4000,1000);






insert into emp(id,ename,joindate,salary,bonus) values(3,null,'1987-11-12',10000,1290);



insert into emp(id,joindate,salary,bonus) values(3,'1987-11-12',10000,1290);






insert into emp values(3,'李四','2000-01-01',1200,100);






insert into emp(id,ename,joindate,salary) values(4,'王五','1999-12-14',3000);






insert into emp(ename,joindate,salary) values('吉米','1995-10-10',3000);






alter table emp modify joindate date unique;
alter table emp modify joindate date;