Introduction To SQL True Or False Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Aparnasunil75
A
Aparnasunil75
Community Contributor
Quizzes Created: 20 | Total Attempts: 40,343
Questions: 12 | Attempts: 2,493

SettingsSettingsSettings
Introduction To SQL True Or False Quiz - Quiz

What is SQL? Have you ever used SQL programming language? Here, we have this "Introduction to SQL quiz" in the true or false format to check your knowledge regarding this standard language. SQL is a database computer language used for storing, manipulating, and retrieving data in relational databases. SQL is extended as a structured query language. Do you know about primary and unique keys? If so, take this test and see how much you know about SQL. All the best!


Questions and Answers
  • 1. 

    It is mandatory to define constraint for each attribute of a table.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    It is not mandatory to define a constraint for each attribute of a table. Constraints are used to enforce rules and restrictions on the data in a table, such as ensuring that certain columns cannot have null values or that values must be unique. While it is good practice to define constraints for attributes that require them, it is not required for every attribute in a table.

    Rate this question:

  • 2. 

    Each table can contain more than one primary key.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Each table can have only one primary key. A primary key is a unique identifier for each row in a table and ensures that each row is uniquely identified. Having more than one primary key in a table would contradict this purpose.

    Rate this question:

  • 3. 

    SQL Server automatically sets the NOT NULL constraint for all the primary key columns if the NOT NULL constraint is not specified for these columns.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In SQL Server, when a primary key column is defined, it is automatically set with the NOT NULL constraint. This means that the column cannot have a null value, ensuring that each record in the table will have a unique value for the primary key column. Therefore, the statement "True" is correct.

    Rate this question:

  • 4. 

    Unique constraints ensures that all the values in a column are distinct/unique.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Unique constraints are used in a database to ensure that all values in a specific column are unique. This means that no two rows in that column can have the same value. By enforcing this constraint, it helps maintain data integrity and prevents duplicate entries. Therefore, the given statement is true.

    Rate this question:

  • 5. 

    The result of a SELECT statement can contain duplicate rows.  

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    A SELECT statement in SQL retrieves data from a database table. It is possible for the result of a SELECT statement to contain duplicate rows if the table being queried has duplicate data. This can happen if there are multiple records in the table with the same values for all columns. Therefore, the statement "The result of a SELECT statement can contain duplicate rows" is true.

    Rate this question:

  • 6. 

    Primary Key does allow the Null Values. where as in Unique key doesn't accept the Null values

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The explanation for the given correct answer is that the statement is incorrect. In a database, a primary key is a column or a set of columns that uniquely identifies each record in a table. Primary keys do not allow null values, meaning that every record must have a value in the primary key column. On the other hand, a unique key also ensures uniqueness but allows null values. Therefore, the statement that primary keys allow null values is false.

    Rate this question:

  • 7. 

    A NULL value is treated as a blank or zero.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A NULL value is not treated as a blank or zero. In databases, a NULL value represents the absence of a value or unknown information. It is different from a blank or zero, as it indicates that the value is missing or undefined.

    Rate this question:

  • 8. 

    By default, each attribute can take NULL values except for the primary key.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In a database, NULL represents the absence of a value. By default, each attribute in a table can have NULL values unless it is specified as the primary key. The primary key is a unique identifier for each record and cannot have NULL values. Therefore, the statement "By default, each attribute can take NULL values except for the primary key" is true.

    Rate this question:

  • 9. 

    A relation may have multiple foreign keys.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In a relational database, a foreign key is a field or a set of fields that refers to the primary key of another table. Since a table can have multiple relationships with other tables, it is possible for it to have multiple foreign keys. These foreign keys establish the connections and maintain the integrity of the data across different tables. Therefore, the statement is true.

    Rate this question:

  • 10. 

    Each foreign key is defined on a multiple attribute.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Foreign keys are used to establish a relationship between two tables in a database. They are defined on a single attribute or column in a table, not on multiple attributes. The purpose of a foreign key is to ensure referential integrity, meaning that the values in the foreign key column must match the values in the referenced primary key column. Therefore, the given statement is incorrect, and the correct answer is False.

    Rate this question:

  • 11. 

    We can use DROP statement to remove a database or table permanently from the system.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The DROP statement in SQL is used to permanently remove a database or table from the system. When we execute the DROP statement, it deletes the specified database or table, including all its data and associated objects. This action cannot be undone, so it is important to use the DROP statement with caution. Therefore, the given statement is true.

    Rate this question:

  • 12. 

    We can insert two records with same roll number in a table if roll is assigned as primary key.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    It is not possible to insert two records with the same roll number in a table if the roll number is assigned as a primary key. A primary key is a unique identifier for each record in a table, and it ensures that no two records have the same value for that particular column. Therefore, if the roll number is set as the primary key, it will enforce uniqueness and prevent the insertion of duplicate records with the same roll number.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 24, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 19, 2020
    Quiz Created by
    Aparnasunil75

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.