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 STUDENTS SELECT * FROM STUDENTS; DELETE STUDENTS FROM STUDENTS WHERE stuID = 1; DROP TABLE STUDENTS; ALTER TABLE STUDENTS ADD CONSTRAINT PRIMARY KEY (stuID); ALTER TABLE STUDENTS ADD PRIMARY KEY (stuID);
时间: 2024-10-02 16:14:25