一、原题 Evaluate the following SQL statements: The above command fails when executed. What could be the reason? A. The BETWEEN clause cannot be used for the CHECK constraint B. SYSDATE cannot be used with the CHECK constraint C. ORD_NO and ITEM_NO c…
包含有默认值的字段删除需要先删除约束,则需要查找约束名
删除约束:
ALTER TABLE dbo.表名DROP CONSTRAINT DF__XXXXXI__Curre__19EB91BA查找表相关约束:
select * from sysobjects where parent_obj in(select id from sysobjects where na…
接上,现有两张表,department和employee 1、为department的manager添加唯一性约束,保证manager列中不出现重复值(unique_manager是随便设置的约束名称)
alter table department
add constraint unique_manager unique…
一、原题 You created an ORDERS table with the following description: Name Null Type ORD_ID NOT NULL NUMBER(2) CUST_ID NOT NULL NUMBER(3) ORD_DATE NOT NULL DATE ORD_AMOUNT NOT…
一、原题 Which two statements are true regarding constraints? (Choose two.) A. A foreign key cannot contain NULL values. B. A column with the UNIQUE constraint can contain NULL values. C. A constraint is enforced only for the INSERT operation on a table.…
一、原题 Which two statements are true regarding constraints? (Choose two.) A. A foreign key cannot contain NULL values. B. The column with a UNIQUE constraint can store NULLS . C. A constraint is enforced only for an INSERT operation on a table. D. You …
个人觉得外键是最难理解的一个也是重点: 直接上例子:
create table t_group ( id int not null, name varchar(30), primary key (id)
); insert into t_group values (1, Group1);
insert into t_group values (2, Group2);
create tab…
1:向表中添加字段
Alter table [表名] add [列名] 类型
2: 删除字段
Alter table [表名] drop column [列名]
3: 修改表中字段类型 (可以修改列的类型,是否为空)
Alter table [表名] alter column [列名] 类型
4:添加主键
Alter table…
12、SQL UNION 和 UNION ALL 操作符 12.1 SQL UNION 操作符 UNION 操作符用于合并两个或多个 SELECT 语句的结果集。 请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列。列也必须拥有相似的数据类型。同时,每条 SELECT 语句中的列的顺序必须相同。 …
一、原题 Which view should a user query to display the columns associated with the constraints on a table owned by the user? A. USER_CONSTRAINTS B. USER_OBJECTS C. ALL_CONSTRAINTS D. USER_CONS_COLUMNS E. USER_COLUMNS 答案: D 二、题目翻译 对于用户自己建…