CREATE TABLE常用命令,table常用命令

來源:互聯網
上載者:User

CREATE TABLE常用命令,table常用命令

CREATE TABLE students(stuID INTEGER     NOT NULL ,stuname char(30)     not null,sex     int     NOT NULL);CREATE TABLE students(stuID INTEGER     NOT NULL ,stuname char(30)     not null,sex     int     NOT NULL,PRIMARY KEY (stuID));CREATE TABLE students(stuID INTEGER     NOT NULL PRIMARY KEY,stuname char(30)     not null,sex     int     NOT NULL);CREATE TABLE score(scoreID INTEGER NOT NULL PRIMARY KEY,stuID     INTEGER NOT NULL,KEMUID     INTEGER NOT NULL,score     FLOAT,FOREIGN KEY SCORE_ID_FK (stuID) REFERENCES students (stuid),CONSTRAINT CHK_SCORE_ZIP CHECK (SCORE > 0));show tables;insert into students values(1,'張三',1);SELECT * FROM STUDENTS;INSERT INTO STUDENTSSELECT * FROM STUDENTS;DELETE STUDENTS FROM STUDENTSWHERE stuID = 1;DROP TABLE STUDENTS;ALTER TABLE STUDENTS ADD CONSTRAINT PRIMARY KEY (stuID);ALTER TABLE STUDENTS ADD PRIMARY KEY (stuID);


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.