将Student表中的Sno属性定义为码(关键词请用大写字母)。 CREATE TABLE Student (Sno CHAR (9) _______________, Sname CHAR (20) NOT NULL, Ssex CHAR (2), Sage SMALLINT, Sdept CHAR (2) );
将Student表中的Sno属性定义为码(关键词请用大写字母)。 CREATE TABLE Student (Sno CHAR (9) _______________, Sname CHAR (20) NOT NULL, Ssex CHAR (2), Sage SMALLINT, Sdept CHAR (2) );
参考答案和解析
CONSTRAINT#REFERENCES
相关考题:
若用如下的SQL语句创建一个表student: CREATE TABLE student(N0 CHAR(20) NOT NULL, NAME CHAR(8) NOT NULL, SEX CHAR(2) , AGE INT) 可以插入到表中的是______。A.(‘1031’,‘曾华’,男,23)B.(‘1031’,‘曾华’,NULL,NULL)C.(NULL,‘曾华’,‘男’,‘23’)D.(‘1031’,‘NULL’,‘男’,23)
若用如下的SQL语句创建一个表S:CREATE TABLE S(S# char(16)NOT NULL;SNAME char(8)NOT NULL,SEX char(2),AGE integer)向表S中插入如下行时,哪一行可以被插入?A)(‘872476’,,‘小芳’,女,‘21’)B)(‘854231’ ,,,‘小明’,NULL,NULL)C)(NULL, ‘小强’,‘男’,65)D)(‘657123’,NULL,‘女’,20)
创建S表时,SNo使用CHAR(5)并且唯一,SName使用CHAR(30),Status使用CHAR(8),City使用CHAR(20)。请在下列用于创建表S的SQL语句空缺处填入正确的内容。CREATE TABLE S(SNo CHAR(5),SName CHAR(30),Status CHAR(8),City CHAR(20),______;
若给出关系Student(S_no,Shame,Sage,S_sex,SD_name,S_add,S_tel),并用SQL语言定义Student关系如下:CREATE Student(S_no CHAR(6), Sname CHAR(30)NOT NULL, Sage CHAR(30), S_sex CHAR(1), SD_name CHAR(20), S_add CHAR(30), S_tel CHAR(20), PRIMARY KEY(S_no));采用(41)向Student中插入记录能被正确地执行。A.INSERT INTO Smdent(S_no,Sname,Sage,S_sex,SD_name,S_add,S_tel)VALUES('010456','黎敏','18',",",",")B.INSERT INTO Student(S_no,Sname,Sage,S_sex,S_r)name,S_add,S_tel)VALUES('010456','黎敏','18','男','计算机学院','北京','88661200')C.INSERT INTO Student(S_no,Sname,Sage,S_sex,SD_name,S_add,S_tel)VALUES(,'黎敏','18','F','计算机学院','北京','88661200')D.INSERT INTO Student(S_no,Sname,Sage,S_sex,SD_name,S_add,S_tel)VALUES('010456',,'18','F','计算机学院','北京','88661200')
教学管理数据库创建了如下表:CTEATE TABLE student(学号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,班号 CHAR(5))CREATE TABLE course(课程号 CHAR(5) not null unique,课程名 CHAR(20),任课教师编号 CHAR(5))CREATE TABLE score(学号 CHAR(5),课程号 CHAR(5),分数 INT)请写出完成检索score表中最高分与最低分之差大于12的课程号的SQL语句。
教学管理数据库创建了如下表:CTEATE TABLE student(学号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,班号 CHAR(5))CREATE TABLE score(学号 CHAR(5),课程号 CHAR(5),分数 INT)请写出完成以下任务需要的SQL语句:查询所有学生的姓名、课程号和分数列。
教学管理数据库创建了如下四张表:CTEATE TABLE student(学号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,班号 CHAR(5))CTEATE TABLE teacher(教师编号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,职称 CHAR(6),系别 CHAR(10))CREATE TABLE course(课程号 CHAR(5) not null unique,课程名 CHAR(20),任课教师编号 CHAR(5))CREATE TABLE score(学号 CHAR(5),课程号 CHAR(5),分数 INT)请写出完成以下任务需要的SQL语句: 1) 检索score表中成绩在60-80之间的所有记录。2) 检索student表中所有姓王的学生记录。
设有学生表:Student(Sno,Sname,Ssex,Sage,Sdept),课程表:Course(Cno,Cname,Credit,Semester),选课表:SC(Sno,Cno,Grade)查询C001课程的考试成绩高于该课程平均成绩的学生的学号和C001课成绩。(请用子查询实现)
设有学生表:Student(Sno,Sname,Ssex,Sage,Sdept),课程表:Course(Cno,Cname,Credit,Semester),选课表:SC(Sno,Cno,Grade)删除“VB”考试成绩最低的学生的VB修课记录。
根据SQL标准,增加一个新的字段sdate到表student中,该字段为可容纳7个字符的定长字符串,下面哪条语句可以参考表述?()A insert into student sdate char(7)B add sdate char(7) to studentC append sdate varchar(7) to table studentD alter table student add sdate varchar(7)E alter table student add sdate char(7)F alter table student modify sdate char(7)
建立一个“职员”表,表中有5个字段:职员号、姓名、性别、年龄、部门。要求职员号属性的值唯一,并且不能为空值。建立该表的SQL语句可以是______。A.CREATE TABLE 职员(职员号 CHAR(6),姓名CHAR(8),; 性别CHAR(2),年龄INT(4),部门CHAR(12))B.CREATE TABLE职员(职员号CHAR(6)NULL,姓名CHAR(8),; 性别CHAR(2),年龄INT(4),部门CHAR(12))C.CREATE TABLE 职员(职员号CHAR(6)NOT NULL UNIQUE,; 姓名CHAR(8),性别CHAR(2),年龄INT(4),部门CHAR(12))D.CREATE TABLE职员(职员号CHAR(6)UNIQUE,姓名CHAR(8),: 性别CHAR(2),年龄INT(4),部门CHAR(12))
用如下的SQL语句创建了一个表S:CREATE TABLE S(SNO CHAR(6) NOT NULL,SNAME CHAR(8) NOT NULL,SEX CHAR(2),AGE INTEGER);现向S表插入如下行时,哪一行可以被插入A)(′991001′,′李明芳′,女,′23′)B)(′990746′,′张为′,NULL,NULL)C)(NULL,′陈道一′,′男′,32)D)(′992345′,NULL,′女′,25)A.(′991001′,′李明芳′,女,′23′)B.(′990746′,′张为′,NULL,NULL)C.(NULL,′陈道一′,′男′,32)D.(′992345′,NULL,′女′,25)
阅读下列说明和E-R图,回答问题1至问题3,将解答填入对应栏内。[说明]某学校的教学系统描述如下:学生信息包括:学号(SNo)、姓名(Sname)、性别(Sex)、年龄(Age)、入学年份(Year)、主修专业(Major),其中学号是入学时唯一编定的。课程信息包括:课程号(CNo)、课程名称(CName)、学时(Period)、学分(Credit),其中课程号是唯一编定的。一个学生可选多门课,每个学生选每门课有一个成绩。图2-1是经分析得到的E-R图。[图2-1]设基本表:Student(SNo,SName,Sex,Age,Year,Major),Course(CNo,Cname,Period,Credit),Grade(SNo,CNo,Grade)通过如下SQL语句建立,请在SQL语句空缺处填入正确的内容。CREATE TABLE Student(SNO CHAR(6)NOT NULL,SName CHAR(20),Sex CHAR(1),Age INTEGER,Year CHAR(4),Major CHAR(20),(1) );CREATE TABLE Course(CNo CHAR(6)NOT NULL,CName CHAR(20),Period INTEGER,Credit INTEGER,(2) );CREATE TABLE Grade(SNo CHAR(6)NOT NULL,CNo CHAR(6)NOT NULL,Grade REAL,(3) ,(4) ,(5) );(1)
阅读下列说明和E-R图,回答问题1至问题3,将解答填入对应栏内。[说明]设有下列关于学生成绩管理系统的E-R图(见图2-1)。图中矩形表示实体,圆表示属性,双圆表示关键字属性,菱形表示实体间的联系。假定已通过下列SQL语言建立了基本表:CREATE TABLE STUDENT(SNo CHAR(6)NOT NULL UNIQUE,SName CHAR(20),Sex CHAR(1),Dept CHAR(20),Age SMALLINT);CREATE TABLE COURSE(CNo CHAR(6)NOT NULL UNIQUE,CName CHAR(20),Hour SMALLINT,Credit SMALLINT);CREATE TABLE SC (SNo CHAR(6),CNo CHAR(6),GRADE SMALLINT,PRIMARY KEY (SNo,CNo));为了答题的方便,图中的实体和属性同时给出了中英文两种名字,回答问题时只须写出英文名即可。填充下列SQL程序5.1~5.4中的(1)~(6),使它们分别完成以下查询功能:程序5.1:检索选修所有课程的学生姓名。程序5.2:给出全体学生人数。程序5.3:按学号给出每个学生的平均成绩。程序5.4:按学号给出每个学生选修课程的门数。[程序5.1]SELECT SName FROM STUDENT WHERE (1)(SELECT FROM COURSE WHERE (2)(SELECT * FROM SC WHERE (3) ))[程序5.2]SELECT (4) FROM STUDENT[程序5.3]SELECT (5) FROM SC GROUP BY SNO[程序5.4]SELECT (6) FROM SC GROUP BY SNO(1)
若给出关系Student(S_no, Sname, Sage, S_sex, SD_name, S_add, S_tel),并用SQL语言定义Student关系如下: CREATE Student(S_no CHAR(6), Sname CHAR(30)NOT NULL, Sage CHAR(30), S_sex CHAR(1), SD_name CHAR(20), S_add CHAR(30), S_tel CHAR(20), PRIMARY KEY(S_no)); 采用(45)向Student中插入记录能被正确地执行。A.INSERT INTO Student(S_no, Sname, Sage, S_sex, SD_name, S_add, S_tel) VALUES('010456', '黎敏', '18', ", ", ", ")B.INSERT INTO Student(S_no, Sname, Sage, S_sex, SD_name, S_add, S_tel) VALUES('010456', '黎敏', '18', '男', '计算机学院', '北京', '88661200')C.INSERT INTO Student(S_no, Sname, Sage, S_sex, SD_name, S_add, S_tel) VALUES(, '黎敏', '18', 'F', '计算机学院', '北京', '88661200')D.INSERT INTO Student(S_no, Sname, Sage, S_sex, SD_name, S_add, S_tel) VALUES('010456', , '18', 'F', '计算机学院', '北京', '88661200')
若某企业的数据库系统中有如下所示的员工关系和仓库关系,每个仓库可有多名员工,但只有一名负责人。员工关系(cmployee):仓库关系(warehouse):则创建仓库表结构的SQL语句为(58)。A.CREATE TABLE(employeeID CHAR(2)NOT NULL UNIQUE, name CHAR(30)NOT NULL, address CHAR(40), pricipallD CHAR(3));B.CREATE warehouse(warehouseD CHAR(2)PRIMARY KEY, name CHAR(30), address CHAR(40), pficipalID CHAR(3));C.CREATE TABLE warehouse(warehouselD CHAR(2)PRIMARY KEY, name CHAR(30)NOT NULL, address CHAR(40), pricipalID CHAR(3), FOREIGN KEY(priciPalID)REFERENCES employee(employeeID));D.CREATE TABLE warehouse(warehouselD CHAR(2), name CHAR(30)NOT NULL, address CHAR(40), pricipalID CHAR(3), PRIMARY KEY(warehouselD), FOREIGN KEY(employeeID)REFERENCES emplo
下面程序的运行结果是typedef union student{ char name[10]; long sno; char sex; float score[4];}STU;main(){ STU a[5]; printf("%d\n",sizeof(a));}
建立一个学生信息表student,要求它由学号sno、姓名sname、性别sex、年龄age4个属性组成,其学号属性唯一,学号、姓名字段不能为空。下列语句正确的是A.CREATE TABLE student(sno char(5) NOT NULL sname char(8) NOT NULL sex char(1) age int);B.CREATE TABLE student (sno char(5) NOT NULL UNIQUE sname char(8) sex char(1) age int);C.CREATE TABLE (sno char(5) NOT NULL UNIQUE sname char(8) NOT NULL sex char(1) age int);D.CREATE TABLE student (sno char(5) NOT NULL UNIQUE sname char(8) NOT NULL sex char(1) age int);
建立一个“职员”表,表中有5个字段:职员号、姓名、性别、年龄、部门。要求职员号属性的值惟一,并且不能为空值。建立该表的SQL语句可以是______。A.CREATE TABLE职员(职员号CHAR(6),姓名CHAR(8),;性别CHAR(2),年龄INT(4),部门CHAR(12))B.CREATE TABLE职员(职员号C1LAR(6) NULL,姓名 CHAR(8),;性别CHAR(2),年龄INT(4),部门CHAR((12))C.CREATE TABLE职员(职员号CHAR(6) NOT NULL UNIQUE,;姓名CHAR(8),性别CHAR(2),年龄INT(4),部门CHAR(12))D.CREATE TABLE职员(职员号CHAR(6)UNIQUE,姓名CHAR(8),;性别CHAR(2),年龄INT(4),部门CHARR(12))
Given the following requirements:Create a table named TESTTAB, which has an identity column named ACTIVITYNO. Define the identity column to generate the values for the column by default. Start the values at 10 and increment by 10. Make the identity column unique. Which of the following CREATE statements will successfully create this table?()A.CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 10 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))B.CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTNO))C.CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 10 INCREMENT BY 1), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))D.CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 10 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))
建立一个学生信息表student,要求它由学号sno,姓名sname,性别sex,年龄age,4个属性组成,其学号属性惟一,学号、姓名字段不能为空。下列语句正确的是A.CREATE TABLE student (sno char(5)NOT NULL sname char(8)NOT NULL sex char age int);B.CREATE TABLE student (sno char(5)NOT NULL UNIQUE sname char(8) sex char age int);C.CREATE TABLE (sno char(5)NOT NULL UNIQUE sname char(8)NOT NULL sex char age int);D.CREATE TABLE student (sno char(5)NOT NULL UNIQUE sname char(8)NOT NULL sex char age int);
用下面的T-SOL语句建立- -个基本表:CREATE TABLE Student (Sno CHAR(4) PRIHART KEY,Sname CHAR(8)NOT MULL,Sex CHAR(2),Age INT)可以插入到表中的元组是( )。A.‘5021′,NULL,男,21B.‘5021′,‘刘祥′,NULL,NULLC.‘5021′,‘刘祥′,男,21D.NULL,‘刘祥′,NULL,21
设数据库中已有教材中的Student(Sno,Sname,Ssex,Sage,Sdept)、Course(Cno,Cname,Credit,Semster)和SC(Sno,Cno,Grade)表。现要查询学生选的第2学期开设课程的情况,只需列出学号、姓名、所在系和所选的课程号。该查询涉及到的表是()。A仅Student表B仅Student和SC表C仅Student和Course表DStudent、SC和Course表
若用如下的SQL语句创建一个student表:CREA TETABLE student(NO CHAR(4)NOT NULL,NAME CHAR(8)NOT NULL,SEX CHAR(2),AGE INT)可以插入到student表中的是()A、(’1031’,’曾华’,男,23)B、(’1031’,’曾华’,NULL,NULL)C、(NULL,’曾华’,’男’,’23’)D、(’1031’,NULL,’男’,23)
设数据库中已有教材中的Student(Sno,Sname,Ssex,Sage,Sdept)、Course(Cno,Cname,Credit,Semster)和SC(Sno,Cno,Grade)表。现要查询学生选的第2学期开设课程的情况,只需列出学号、姓名、所在系和所选的课程号。该查询涉及到的表是()。A、仅Student表B、仅Student和SC表C、仅Student和Course表D、Student、SC和Course表
Given the following requirements:Create a table named TESTTAB, which has an identity column named ACTIVITYNO. Define the identity column to generate the values for the column by default. Start the values at 10 and increment by 10. Make the identity column unique. Which of the following CREATE statements will successfully create this table?()A、CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 10 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))B、CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTNO))C、CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 10 INCREMENT BY 1), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))D、CREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 10 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))
单选题Given the following requirements:Create a table named TESTTAB, which has an identity column named ACTIVITYNO. Define the identity column to generate the values for the column by default. Start the values at 10 and increment by 10. Make the identity column unique. Which of the following CREATE statements will successfully create this table?()ACREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 10 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))BCREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTNO))CCREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 10 INCREMENT BY 1), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))DCREATE TABLE TESTTAB (ACTIVITYNO SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 10 INCREMENT BY 10), ACTKWD CHAR(6) NOT NULL, ACTDESC VARCHAR(20) NOT NULL, UNIQUE(ACTIVITYNO))
单选题设数据库中已有教材中的Student(Sno,Sname,Ssex,Sage,Sdept)、Course(Cno,Cname,Credit,Semster)和SC(Sno,Cno,Grade)表。现要查询学生选的第2学期开设课程的情况,只需列出学号、姓名、所在系和所选的课程号。该查询涉及到的表是()。A仅Student表B仅Student和SC表C仅Student和Course表DStudent、SC和Course表