SQL Training Jan13 - Quiz1

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 Snudurupati
S
Snudurupati
Community Contributor
Quizzes Created: 1 | Total Attempts: 212
Questions: 21 | Attempts: 212

SettingsSettingsSettings
SQL Training Jan13 - Quiz1 - Quiz

Test your basic database skills, RDBMS, DDL, DML, Normalization etc.


Questions and Answers
  • 1. 

    A Multidimensional Cube is a type of a relational database

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A multidimensional cube is not a type of a relational database. It is a data structure used in online analytical processing (OLAP) to organize and analyze data in multiple dimensions. Relational databases, on the other hand, store data in tables with rows and columns and use relationships between tables to query and manipulate data. Therefore, the statement is false.

    Rate this question:

  • 2. 

    The following table is in 1NF

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given table is not in 1NF (First Normal Form) because it does not meet the requirement of having atomic values in each cell. The table should be organized in such a way that each attribute has a single value in each cell, and there should be no repeating groups or arrays. Without further information about the table's structure, it cannot be determined if it meets the requirements of higher normal forms.

    Rate this question:

  • 3. 

    A table in 3NF is already in 1NF and 2NF

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    A table in 3NF is already in 1NF and 2NF because 3NF (Third Normal Form) is a higher level of normalization that builds upon the previous normal forms. The first normal form (1NF) ensures that the table has a primary key and no repeating groups, while the second normal form (2NF) eliminates partial dependencies by ensuring that all non-key attributes are fully dependent on the primary key. Therefore, if a table is in 3NF, it has already met the requirements of 1NF and 2NF.

    Rate this question:

  • 4. 

    What does SQL stand for?

    • A.

      Structured Query Language

    • B.

      Strong Query Language

    • C.

      Structured Question Language

    Correct Answer
    A. Structured Query Language
    Explanation
    SQL stands for Structured Query Language. It is a programming language that is used for managing and manipulating relational databases. SQL allows users to create, modify, and retrieve data from databases using various commands and statements. It is a standardized language that is widely used in the field of database management systems.

    Rate this question:

  • 5. 

    Which SQL keyword is used to extract data from a table

    • A.

      EXTRACT

    • B.

      OPEN

    • C.

      PULL

    • D.

      SELECT

    Correct Answer
    D. SELECT
    Explanation
    The keyword "SELECT" is used in SQL to extract data from a table. It allows you to specify the columns you want to retrieve and any conditions or filters to apply to the data. By using the SELECT keyword, you can retrieve specific data from one or more tables in a database.

    Rate this question:

  • 6. 

    Which SQL keyword is used to update data in a table.

    • A.

      MODIFY

    • B.

      UPDATE

    • C.

      SAVE

    • D.

      SAVE AS

    Correct Answer
    B. UPDATE
    Explanation
    The correct answer is UPDATE. In SQL, the UPDATE keyword is used to modify or update existing data in a table. It allows you to change the values of one or more columns in a specific row or multiple rows of a table. By using the UPDATE keyword along with the SET clause, you can specify the new values for the columns that need to be updated. This statement is essential for making changes to the data stored in a table without having to delete and reinsert the entire row.

    Rate this question:

  • 7. 

    Which SQL keyword is used to insert new data in a table

    • A.

      ADD NEW

    • B.

      ADD RECORD

    • C.

      INSERT NEW

    • D.

      INSERT INTO

    Correct Answer
    D. INSERT INTO
    Explanation
    The correct answer is "INSERT INTO". This keyword is used in SQL to insert new data into a table. It is followed by the table name and the values that need to be inserted.

    Rate this question:

  • 8. 

    How to select all columns from a table Employee

    • A.

      SELECT * FROM Employee

    • B.

      SELECT * .Employee

    • C.

      SELECT * FROM Persons

    • D.

      SELECT ALL FROM Employee

    Correct Answer
    A. SELECT * FROM Employee
    Explanation
    The correct answer is "SELECT * FROM Employee". This is the correct syntax to select all columns from a table named "Employee". The asterisk (*) represents all columns, so when it is combined with the "SELECT" statement and the table name, it retrieves all the columns from that specific table. The other options provided in the question are incorrect syntax and do not follow the standard SQL format for selecting all columns.

    Rate this question:

  • 9. 

    Which SQL statement will select all the rows and columns from the table "Employee" and sort them in descending order by "Salary" column.

    • A.

      SELECT * FROM Employee ORDER BY EmpID ASC

    • B.

      SELECT * FROM Employee ORDER BY EmpID DESC

    • C.

      SELECT * FROM Employee ORDER BY Salary ASC

    • D.

      SELECT * FROM Employee ORDER BY Salary DESC

    Correct Answer
    D. SELECT * FROM Employee ORDER BY Salary DESC
    Explanation
    The given correct answer is "SELECT * FROM Employee ORDER BY Salary DESC". This statement will select all the rows and columns from the table "Employee" and sort them in descending order by the "Salary" column.

    Rate this question:

  • 10. 

    Which of the following SQL statements is correct and has no syntax errors?

    • A.

      INSERT INTO Employee (EmpID,Salary) VALUES (2321,25000.99)

    • B.

      SAVE INTO Employee (EmpID,Salary) VALUES (2321,25000.99)

    • C.

      UPDATE INTO Employee (EmpID,Salary) VALUES (2321,25000.99)

    • D.

      INSERT INTO Employee EmpID,Salary VALUES 2321,25000.99

    Correct Answer
    A. INSERT INTO Employee (EmpID,Salary) VALUES (2321,25000.99)
    Explanation
    The correct answer is "INSERT INTO Employee (EmpID,Salary) VALUES (2321,25000.99)". This is the correct syntax for inserting a new record into the Employee table, specifying the columns (EmpID and Salary) and their corresponding values (2321 and 25000.99). The other options have syntax errors or are not valid SQL statements.

    Rate this question:

  • 11. 

    SQL statement to delete all rows from a table "Employee".

    • A.

      REMOVE * FROM Employee

    • B.

      DELETE ALL FROM Employee

    • C.

      TRUNCATE TABLE Employee

    • D.

      DROP TABLE Employee

    Correct Answer
    C. TRUNCATE TABLE Employee
    Explanation
    The correct answer is TRUNCATE TABLE Employee. This SQL statement is used to delete all rows from a table in the database. It is a faster and more efficient method compared to using the DELETE statement, as it does not generate any log entries for each deleted row. Additionally, it also resets the identity column, if present, to its initial seed value.

    Rate this question:

  • 12. 

    Which of the following statements is/are true for a Primary Key Constraint?

    • A.

      1. Prevents deletion of the table

    • B.

      2. Prevents NULL values to be inserted into the Primary Key column

    • C.

      3. Prevents insertion of duplicate rows

    • D.

      4. Both 2 & 3

    Correct Answer
    D. 4. Both 2 & 3
    Explanation
    A primary key constraint is a rule that ensures the uniqueness and integrity of a primary key in a database table. It prevents NULL values from being inserted into the primary key column, which helps maintain data integrity. Additionally, it also prevents the insertion of duplicate rows, ensuring that each row in the table has a unique primary key value. Therefore, the correct answer is option 4, which states that both statement 2 and statement 3 are true for a primary key constraint.

    Rate this question:

  • 13. 

    A Primary Key can be NULL.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A primary key is a unique identifier for a record in a database table. It cannot be NULL because it is used to ensure the uniqueness of each record. If a primary key were allowed to be NULL, it would defeat the purpose of having a primary key as it would not be able to uniquely identify a record. Therefore, the correct answer is False.

    Rate this question:

  • 14. 

    Which of the following is/are true for a Foreign Key Constraint?

    • A.

      Enforces Referential Integrity

    • B.

      Enforces Parent-Child relationship

    • C.

      Prevents deletion of Parent table while child table still exists

    • D.

      Prevents insertion of Foreign Key values into the Child table that do not exist in the Parent table

    • E.

      All of the above

    Correct Answer
    E. All of the above
    Explanation
    A Foreign Key Constraint is a rule in a relational database that ensures the integrity of the data by enforcing referential integrity, which means that it maintains the relationship between the parent and child tables. It prevents the deletion of the parent table while the child table still exists, ensuring that the relationship is maintained. Additionally, it prevents the insertion of foreign key values into the child table that do not exist in the parent table, ensuring that only valid data is inserted. Therefore, all of the statements mentioned in the options are true for a Foreign Key Constraint.

    Rate this question:

  • 15. 

    CREATE TABLE Employee ( EmpID INT IDENTITY CONSTRAINT PK_EMP PRIMARY KEY NOT NULL, EmployeeName VARCHAR(20), Salary NUMERIC(10,2)) In the above SQL what is the significance of IDENTITY keyword.

    • A.

      Enforces Primary Key Constraint

    • B.

      Makes column not NULL

    • C.

      Automatically assigns a value to EmpID column when a new row is inserted.

    • D.

      Doesn't do anything

    Correct Answer
    C. Automatically assigns a value to EmpID column when a new row is inserted.
    Explanation
    The IDENTITY keyword in the SQL statement automatically assigns a value to the EmpID column when a new row is inserted. This means that the EmpID column will have a unique value for each row without the need for manual input or intervention. This can be useful for creating a unique identifier for each employee in the table.

    Rate this question:

  • 16. 

    ALTER TABLE Persons ALTER COLUMN PersonName VARCHAR(50) What does the above SQL statement achieve ?

    • A.

      Changes PersonName datatype from INT to VARCHAR

    • B.

      Changes PersonName datatype to VARCHAR(50)

    • C.

      Drops PersonName column from the table

    • D.

      Insufficient information

    Correct Answer
    B. Changes PersonName datatype to VARCHAR(50)
    Explanation
    The given SQL statement "ALTER TABLE Persons ALTER COLUMN PersonName VARCHAR(50)" changes the datatype of the column "PersonName" in the table "Persons" to VARCHAR(50). This means that the column will now store character string values with a maximum length of 50 characters.

    Rate this question:

  • 17. 

    SELECT EmpID, EmpName FROM Employee WHERE EmpID = 2321 The above SQL statement is a

    • A.

      DCL Statement

    • B.

      DDL Statement

    • C.

      XML Statement

    • D.

      DML Statement

    Correct Answer
    D. DML Statement
    Explanation
    The above SQL statement is a DML (Data Manipulation Language) statement because it is used to retrieve data from the Employee table. It uses the SELECT keyword to specify the columns (EmpID and EmpName) that should be returned. The WHERE clause is used to filter the results based on the condition that the EmpID should be equal to 2321. DML statements are used to manipulate data in a database, such as retrieving, inserting, updating, or deleting records.

    Rate this question:

  • 18. 

    ALTER TABLE Persons ALTER COLUMN PersonName VARCHAR(50) The above statement is a

    • A.

      HTML Statement

    • B.

      DDL Statement

    • C.

      DML Statement

    • D.

      SQR Statement

    Correct Answer
    B. DDL Statement
    Explanation
    The given statement "ALTER TABLE Persons ALTER COLUMN PersonName VARCHAR(50)" is a DDL (Data Definition Language) statement. DDL statements are used to define or modify the structure of database objects such as tables, columns, indexes, etc. In this case, the statement is altering the column "PersonName" in the "Persons" table, changing its data type to VARCHAR with a maximum length of 50 characters.

    Rate this question:

  • 19. 

    Which SQL clause is useful in choosing the columns to be displayed in the results?

    • A.

      WHERE clause

    • B.

      FROM clause

    • C.

      SELECT clause

    • D.

      ORDER BY clause

    Correct Answer
    C. SELECT clause
    Explanation
    The SELECT clause is used in SQL to choose the columns that will be displayed in the results of a query. It allows the user to specify which columns they want to retrieve from the database. The SELECT clause is essential in determining the specific information that is needed from the database, making it the correct answer to this question.

    Rate this question:

  • 20. 

    Which SQL clause is useful in limiting the number of rows displayed in the results?

    • A.

      SELECT clause

    • B.

      FROM clause

    • C.

      WHERE clause

    • D.

      Santa Claus

    Correct Answer
    C. WHERE clause
    Explanation
    The WHERE clause is used in SQL to filter rows based on a specific condition. It is commonly used to limit the number of rows displayed in the results by specifying a condition that must be met for a row to be included. This allows for more precise control over the data that is returned, making the WHERE clause the correct answer for limiting the number of rows displayed in the results.

    Rate this question:

  • 21. 

    What did you think of the Quiz? (Not graded)

    • A.

      Very useful

    • B.

      Somewhat useful

    • C.

      Too easy

    • D.

      Only if I had more time.

    Explanation
    This question asks for the respondent's opinion on the quiz. The correct answer is subjective and will vary depending on the individual's experience and perception.

    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
  • Mar 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 10, 2013
    Quiz Created by
    Snudurupati

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.