SQL CH 01
SQL CH 01
2
B. One instance of an entity
C. An attribute of an entity
D. A single value
Answer: C
Q16. What does a single row in a table represent?
A. A collection of entries
B. One instance of an entity
C. An attribute of an entity
D. A single value
Answer: B
Q17. What is a primary key?
A. One or more columns that establishes link between tables
B. One or more columns that uniquely identify each row in a table
C. A constraint that enforces a value to be present in a column
D. A column whose value is automatically generated by the system
Answer: B
Q18. Non-primary key column that does not contain duplicates is defined as ________.
A. Index
B. Foreign key
C. Nullibility
D. Unique key
Answer: D
Q20. What is an index?
A. It uniquely identifies each row in a table
B. It enforces enterprise rules on the value of a column
C. It provides an efficient way of accessing rows in an table based on one or more
columns
D. It establishes relationship between tables
Answer: C
Q21. An index is automatically created for a tables primary key.
A. True
B. False
Q22. Relationships exist between ____________.
A. Between the primary keys in two tables
B. Between the foreign keys in two tables
C. Between the primary key in one table and the foreign key in another table
D. All of the above
Q23. If a table has a one-to-one relationship with another table, the data in two tables
can be stored in one table.
A. True
B. False
Answer:, A [Ref. : Page 30]
Q24. Many-to-many relationships can be implemented in SQL Server.
A. True
B. False
Answer: B
[no RDBMS can implement many-to-many relationship]
Q25. How is many-to-many implemented?
3
A. By breaking down into two one-to-one relationships
B. By breaking down into two one-to-many relationships
C. By breaking down into two many-to-many relationships
D. By using check constraint
Answer: C
Q26. A table can have only one foreign key.
A. True
B. False
Answer: B
[Ref. : Page 31, a table can have more than one foreign key column]
Q27. How can you define what type of data a column can store?
A. By setting its data type
B. By defining default value
C. By allowing .null value
D. By defining check rule
Answer: A
Q28. What is an identity column in SQL Server?
A. A column that uniquely identifies each row
B. A column that can store null value
C. A column that has auto-incremented numeric value and its value is generated
by SQL server
D. A column that has a default value
Answer: D
Q28. What data type only allows value 1 or 0 that represents a True or False value?
A. Boolean
B. Tinyint
C. Bit
D. Int
Answer: C
Q29. The type and size of the information that can be stored in the column is
determined by _______________.
A. Primary key
B. Default value
C. Data type
D. NULL or NOT NULL
Answer: C
Q30. ___________________ of column defines that value is used if a value is not provided
when a row is added to the table.
A. Identity
B. Unique key
C. Data type
D. Default value
Answer: D
Q31. SQL fall into two categories. They are _________________.
A. data manipulation language (DML)
B. data definition language (DDL)
C. XQuery
D. Object Query
4
Answer: A, B
Q32. SQL progra1n1ners typically work with the DDL statements, while database
administrators (DBAs) use the DDL statements.
A. True
B. False
Answer: B
[Reverse is true, SQL progra1n1ners typically work with the DML statements, while
database administrators (DBAs) use the DDL statements. Re.: Page 23]
Q33. Which one is NOT a DDL statement?
A. CREATE statement
B. ALTER statement
C. DELETE statement
D. DROP statement
Answer: C
Q34. Which one is NOT a DML statement?
A. SELECT statement
B. INSERT statement
C. ALTER statement
D. DELETE statement
Answer: C
Q35. Which statement do you use to delete a database object?
A. ALTER statement
B. DELETE statement
C. DROP statement
D. TRUNCATE statement
Answer: C
Q36. To create a new row in a table you use ____________________ statement?
A. CREATE
B. INSERT
C. ADD
D. ALTER
Answer: B
Q37. To modify data in a table you use ____________________ statement?
A. ALTER
B. MODIFY
C. UPDATE
D. INSERT
Answer: C
Q38. The operation which combines the data from the two tables is joined together into
a single result set is called _________________.
A. Union
B. Join
C. Data set
D. Merging
Answer: B
Q39. The most common type of join is _______________.
A. Inner join
B. Outer join
5
C. Cross join
D. Self-join
Answer: A
Q40. ___________________ returns rows from both tables only if their related columns
match.
A. An inner join
B. An outer join
C. A cross join
D. A full outer join
Answer: A
Q41. _______________________ returns rows from one table in the join even if the other
table doesn't contain a matching row.
A. An inner join
B. An outer join
C. A cross join
D. A self-join
Answer: B
Q42. Which one is often referred to as query?
A. SELECT statement
B. INSERT statement
C. UPDATE statement
D. DELETE statement
Answer: A
[Ref.: Page 27]
Q43. The execution of an INSERT, UPDATE, or DELETE statement is often referred to as
________________.
A. a query
B. an action query
C. a modification query
D. a change query
Answer: B
[Ref.: Page 31]
Q44. What is a view?
A. A predefined select query that's stored in a database
B. A set of statements, not limited to only one select statement, stored as an object
C. A special type of procedure that can return a value or a table
D. a special type of procedure that's executed when rows are inserted, updated, or
deleted from a table or when the definition of a database is changed
Answer: A
Q45. What is a user-defined function?
A. A predefined select query that's stored in a database
B. A set of statements, not limited to only one select statement, stored as an object
C. A special type of procedure that can return a value or a table
D. a special type of procedure that's executed when rows are inserted, updated, or
deleted from a table or when the definition of a database is changed
Answer: C
Q46. What is a trigger?
A. A predefined select query that's stored in a database
6
B. A set of statements, not limited to only one select statement, stored as an object
C. A special type of procedure that can return a value or a table
D. a special type of procedure that's executed when rows are inserted, updated, or
deleted from a table or when the definition of a database is changed
Answer: D