Oracle Database Questions and Answers – Foreign, Candidate, Primary, Composite, Unique Keys

This set of Oracle Database Multiple Choice Questions & Answers (MCQs) focuses on “Foreign, Candidate, Primary, Composite, Unique Keys”.

1. How can a SQL developer add a key on a table?
a) While creating a table
b) With Alter table command
c) With SQL server Properties window
d) All of the Mentioned
View Answer

Answer: d
Explanation: Adding key on a table can be done with all the above mentioned way.

2. A _______________ key is a minimal super key
a) Primary
b) Foreign
c) Candidate
d) Non-Prime
View Answer

Answer: c
Explanation: In the relational model of databases, a candidate key of a relation is a minimal superkey for that relation.

3. Which of the following is not a Key in SQL Server?
a) Primary
b) Foreign
c) Alternate
d) Secondary
View Answer

Answer: d
Explanation: Except Secondary all are the types of key in SQL server.
advertisement
advertisement

4. What is true about Unique and primary key?
a) Unique can have multiple NULL values but Primary can’t have.
b) Unique can have single NULL value but Primary can’t have even single.
c) Both can have duplicate values
d) None of the Mentioned
View Answer

Answer: b
Explanation: Primary key doesn’t allow Null values and Unique key allows Null value, but only one Null value.

5. By default, which key creates Clustered index?
a) Foreign Key
b) Unique Key
c) Primary Key
d) None of the Mentioned
View Answer

Answer: c
Explanation: Primary Key by default it adds a clustered index.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. A Key which is a set of one or more columns that can identify a record uniquely is called?
a) Natural key
b) Candidate key
c) Not Null key
d) Alternate key
View Answer

Answer: b
Explanation: A candidate key is a combination of attributes that can be uniquely used to identify a database record without any extraneous data. Each table may have one or more candidate keys. One of these candidate keys is selected as the table primary key.

7. Which key accepts multiple NULL values?
a) Foreign Key
b) Unique Key
c) Primary Key
d) None of the Mentioned
View Answer

Answer: a
Explanation: A foreign key is a key used to link two tables together. This is sometimes called a referencing key.Foreign Key is a column or a combination of columns whose values match a Primary Key in a different table.
advertisement

8. A Foreign key is combined with a foreign key creates
a) Parent child relationship between the tables that connect them
b) Many-Many relationship between the tables that connect them
c) Network model between the tables that connect them
d) None of the Mentioned
View Answer

Answer: a
Explanation: In a foreign key reference, a link is created between two tables when the column or columns that hold the primary key value for one table are referenced by the column or columns in another table. This column becomes a foreign key in the second table.

9. Which of the following statements is not correct?
a) The primary key must be unique for a given table
b) Specifying a zero (0) for the lower bound for the association multiplicity on a class diagram indicates that the item is required
c) Specifying a one (1) for the lower bound for the association multiplicity on a class diagram indicates that the item is required
d) Most databases allow multiple records that are identical
View Answer

Answer: b
Explanation: A foreign key is a column that references a column (most often the primary key) of another table. The purpose of the foreign key is to ensure referential integrity of the data. In other words, only values that are supposed to appear in the database are permitted.
advertisement

10. In a database, a foreign key is ?
a) A data element/attribute within a data field of a data record that is not unique, and cannot be used to distinguish one data record in a database from another data record within a database table
b) A data element/attribute within a data field of a data record within a database table that is a secondary key in another database table
c) A data element/attribute within a data field of a data record within a database table that is a primary key in another database table
d) A data element/attribute within a data field of a data record that enables a database to uniquely distinguish one data record in a database from another data record within a database table
View Answer

Answer: c
Explanation: A FOREIGN KEY constraint can reference columns in tables in the same database or within the same table. These are called self-referencing tables. For example, consider an employee table that contains three columns: employee_number, employee_name, and manager_employee_number. Because the manager is also an employee, there is a foreign key relationship from the manager_employee_number column to the employee_number column.

Sanfoundry Global Education & Learning Series – Oracle Database.

To practice all areas of Oracle Database, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.