下列关于主键约束的语句哪个不正确
A: CREATE TABLE STU(no INT PRIMARY KEY,name VARCHAR2(20))
B: CREATE TABLE STU(no INT,name VARCHAR2(20),PRIMARY KEY(no))
C: CREATE TABLE SCORE(sno INT,cno INT,score INT,PRIMARY KEY(sno,cno))
D: CREATE TABLE SCORE(sno INT PRIMARY KEY,cno INT PRIMARY KEY,score INT)
A: CREATE TABLE STU(no INT PRIMARY KEY,name VARCHAR2(20))
B: CREATE TABLE STU(no INT,name VARCHAR2(20),PRIMARY KEY(no))
C: CREATE TABLE SCORE(sno INT,cno INT,score INT,PRIMARY KEY(sno,cno))
D: CREATE TABLE SCORE(sno INT PRIMARY KEY,cno INT PRIMARY KEY,score INT)
举一反三
- 下来定义表的约束语法,错误的是() A: create table t1(id number primary key,name varchar2(10)) B: create table t1(id number constraint p_k primary key(id),name varchar2(10)) C: create table t1(id number constraint p_k primary key,name varchar2(10)) D: create table t1(id number,name varchar2(10),primary key(id))
- 为表TEST中ID列添加主键约束的语法是() A: ALTER TABLE TEST CHANGE( ID INT PRIMARY KEY) B: ALTER TABLE TEST ADD( ID INT PRIMARY KEY) C: ALTER TABLE TEST MODIFY( ID INT PRIMARY KEY) D: ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY (ID)
- 创建学生表:CREATE TABLE Student([br][/br]Sno char(6),[br][/br]Sname varchar(8),[br][/br]Ssex char(2),[br][/br]Sbirth DATE,[br][/br]Sdept varchar(30)[br][/br]);[br][/br]现在要添加主键的代码正确的是( )。 A: ALTER TABLE student ADD PRIMARY KEY(Sno); B: ALTER TABLE student ADD PRIMARY KEY Sno ; C: ALTER TABLE student ADD unique (Sno); D: ALTER TABLE student PRIMARY KEY(Sno);
- 阅读下面SQL代码: CREATE TABLE student( id INT(3) PRIMARY KEY AUTO_INCREMENT, name VARCHAR(20) NOT NULL, grade FLOAT, ); 下面选项中,用于查询表中所有记录信息的SQL语句是
- 在CREATE TABLE语句中,使用( ) 关键字来指定主键。 A: PRIMARY B: MAIN KEY C: PRIMARY KEY D: FOREIGN KEY