sql for data science with r coursera answers week 2

Practice Quiz

1. What is the function of a primary key?

  • The primary key is used to identify any rows in the table that contain NULL values.
  • The primary key is used to grant access to a table.
  • The primary key uniquely identifies each row in a table.
  • The primary key enables you to add data to columns.

2. True or False: Data Manipulation Language statements like INSERT, SELECT, UPDATE, and DELETE are used to read and modify data.

  • True
  • False

3. Data Definition Language (or DDL) statements are used to define, change, or delete database objects such as tables. Which of the following statements are all DDL statements?

  • INSERT and UPDATE
  • SELECT, INSERT, UPDATE
  • SELECT and DELETE
  • CREATE, ALTER, DROP

4. Which of the following queries will change the data type of an existing column (phone) to the varchar data type?

  • ALTER TABLE author ALTER COLUMN phone DATA TYPE = VARCHAR(20);
  • ALTER COLUMN phone SET DATA TYPE VARCHAR(20);
  • ALTER TABLE author ALTER COLUMN phone SET TYPE VARCHAR(20);
  • ALTER TABLE author ALTER COLUMN phone SET DATA TYPE VARCHAR(20);

5. The five basic SQL commands are:

  • SELECT, COPY, PASTE, INSERT, ALTER
  • CREATE, SELECT, INSERT, UPDATE, DELETE
  • None of the above
  • CREATE, INSERT, RETRIEVE, MODIFY, DELETE

Graded Quiz: Relational DB Concepts and Tables

6. The primary key of a relational table uniquely identifies each _______ in a table.

  • row
  • column
  • relation
  • attribute

7. Which of the following statements about a database is/are correct?

  • A database is a logically coherent collection of data with some inherent meaning
  • Data can only be added and queried from a database, but not modified.
  • Only SQL can be used to query data in a database.
  • All of the above

8. Attributes of an entity become ________ in a table.

  • rows
  • columns
  • constraints
  • keys

9. What are the basic categories of the SQL language based on functionality?

  • Data Definition Language
  • Data Manipulation Language
  • Both of the above
  • None of the above

10. The CREATE TABLE statement is a....

  • DML statement
  • DDL statement
  • Both of the above

Leave a Reply