实例记录
测试记录
mysql -u root -p
CREATE DATABASE dbschool;
use dbschool;
CREATE TABLE IF NOT EXISTS `student` (
studentName varchar(30) not null,
studentId int not null,
studentAge int not null,
loginPass varchar(10),
PRIMARY KEY ( `studentId` )
);
CREATE TABLE IF NOT EXISTS `teacher` (
teacherName varchar(30) not null,
teacherId int not null,
teacherAge int not null,
loginPass varchar(10),
PRIMARY KEY ( `teacherId` )
);
INSERT INTO student ( studentName, studentId,studentAge,loginPass)
VALUES
("xiaoming",1,19,"00001");
INSERT INTO student ( studentName, studentId,studentAge,loginPass)
VALUES
("xiaoming",2,19,"00001");
SELECT studentName, studentId,studentAge,loginPass
FROM student;
SELECT *
FROM student;
UPDATE student SET studentName="xiaohong",studentAge=20 WHERE studentId=1;
DELETE FROM student WHERE studentId=1;
SELECT *
FROM student
WHERE studentId>1;