Font size
WorksheetsSQL - Constraints
Total questions: 15
Worksheet time: 8mins
Which command is used for removing a table and all its data from the database:
Create command
Drop table command
Alter table command
All of the mentioned
Which constraint(s) can be used to make sure that the column is not left empty?
NOT NULL
UNIQUE
PRIMARY KEY
ALL THE ABOVE
______________ constraint prevents NULL values
UNIQUE
NOT NULL
NULL
FOREIGN KEY
5. ___________ constraint ensures that no two rows have the same value in the specified columns.
Primary Key
Unique
Default
Check
6. ___________ which helps to uniquely identify a record.
Primary key Constraint
Unique Constraint
Default constraint
Check constraint
7. _________ helps to set a limit value placed for a field.
DEFAULT Constraint
Primary Key Constraint
Check Constraint
TABLE CONSTRAINT
A primary key can be NULL in the table? TRUE or FALSE
TRUE
FALSE
SELECT * FROM cars WHERE Doors > 3
would return how many records?
1
2
3
4
SELECT * FROM Students WHERE Gender="Female" AND Class=2.2
would return how many records?
1
2
3
4
What is a ‘tuple’?
A row or record in a database table
Another name for the key linking different tables in a database.
An attribute attached to a record.
Another name for a table in an RDBMS.
With SQL, how can you insert a new record into the "Persons" table?
INSERT ('Jimmy', 'Jackson') INTO Persons
INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
The NOT NULL constraint enforces a column to not accept empty values.
Next ❯
TRUE
FALSE
In the given query which of the keyword has to be inserted?
INSERT INTO employee _____ (1002,Joey,2000);
Table
Values
Relation
Field
CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT NULL);
INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);
Some of these insert statements will produce an error. Identify the statement.
Insert into employee values (1005,Rach,0);
Insert into employee values (1002,Joey,335);
Insert into employee values (1007,Ross, );
None of the mentioned
