美文网首页
实例记录

实例记录

作者: 遇见你_17be | 来源:发表于2019-01-24 18:07 被阅读0次

    测试记录

    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;

    相关文章

      网友评论

          本文标题:实例记录

          本文链接:https://www.haomeiwen.com/subject/hmeujqtx.html