Mysql创建数据库案例
软件:MySQL-Font
1.创建数据库
CREATE DATABASE test2.建表
CREATE TABLE `STU` ( `stuID` varchar(30) NOT NULL, `stuName` varchar (50) NOT NULL, `stuSex` CHAR(2) NULL, `stuAge` int, `stuJg` varchar(30), `stuDept` varchar(40), PRIMARY KEY (`stuID`), CONSTRAINT `stuSex` CHECK (`stuSex` in('男','女')) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;3.表中插入数据
INSERT INTO `STU` VALUES ('sp001', '孙悟空', '男',21,'花果山','少林派'); INSERT INTO `STU` VALUES ('sp002','猪八戒','男',15,'高老庄','天上的'); INSERT INTO `STU` VALUES ('sp003','沙悟净','男',26,'流沙河','水里的'); INSERT INTO `STU` VALUES ('sp004','唐三藏','男',21,'长安','庙里的');4.查看表数据
select * from stu
--------------------------continue--------------------------------