Get All Weeks Introduction to Databases Coursera Quiz Answers
Table of Contents
Week 1: Introduction to Databases Coursera Quiz Answers
Quiz 1: Knowledge check: Databases and data
Question 1: What is a Database in computing?
[expand title=View Answer] James P. Grant [/expand]
- A collection of organized data stored and accessed electronically.
- A collection of tables of data stored and accessed electronically.
Question 2: Which database model uses only tables to store data?
[expand title=View Answer] Relational databases [/expand]
Question 3: Which of the following is a key advantage of organizing data in tables?
[expand title=View Answer] To provide a clear view of the data[/expand]
Question 4: The foreign key can be used to identify a specific record of data in a relational database.
[expand title=View Answer] True [/expand]
Question 5: Big data contains a wide variety of data, arriving in increasing volumes and at high velocities.
[expand title=View Answer] True [/expand]
Quiz 2: Knowledge check: SQL syntax review
Question 1: What makes SQL a popular database language? Select all that apply.
[expand title=View Answer]
1.It works with different relational database management systems.
2.It is an easy programming language to understand and learn.
[/expand]
Question 2: Which of the following commands belong to the SQL data manipulation language (DML)? Select all that apply.
[expand title=View Answer]
1.Select
2.Update
3.Insert
[/expand]
Question 3: The SELECT command should be used to retrieve data from a database table.
[expand title=View Answer] True[/expand]
Question 4: Which SQL syntax should be used to create a student table?
[expand title=View Answer] CREATE TABLE Student [/expand]
Question 5: Choose the correct syntax to create a college database in SQL.
[expand title=View Answer] CREATE DATABASE COLLEGE[/expand]
Quiz 3: Knowledge check: Database structure
Question 1: What term is used to describe the complete information about one specific staff member in a college database that contains data about staff?
[expand title=View Answer] James P. Grant [/expand]
- Table
- Column
- Record
Question 2: What is the minimum number of tables that must be present in a relational database?
[expand title=View Answer] One table[/expand]
Question 3: What is the name of the attribute that is chosen in the database to uniquely identify each record in a table?
[expand title=View Answer] Primary Key [/expand]
Question 4: Which attribute could be used as a primary key in the following customer table?
Customer-first name | Customer last name | Customer email address |
Carl | Anderson | [email protected] |
Mark | Jacky | [email protected] |
[expand title=View Answer] Customer email address [/expand]
Question 5: Which of the following keys can you select as the primary key in a relational database? Select all that apply.
[expand title=View Answer]
1.Alternate key
2.Candidate Key
[/expand]
Quiz 4: Module quiz: Introduction to Databases
Question 1: What is the most used database type in computing?
[expand title=View Answer] Relational Database[/expand]
Question 2: Which one of the following is an advantage of storing data in tables?
[expand title=View Answer] Tables provide a simple and clear view of data [/expand]
Question 3: In a bookshop database, the complete information about one specific book is referred to as a ______________.
[expand title=View Answer]Record [/expand]
Question 4: What makes SQL a very popular database language? Select all that apply.
[expand title=View Answer] SQL works with different relational database management systems.[/expand]
Question 5: Which SQL command is used to update data in a database table?
[expand title=View Answer] UPDATE command[/expand]
Question 6: Which of the following database management systems uses the SQL language? Select all that apply.
[expand title=View Answer]
1.Oracle
2.MySQL
3.PostgreSQL
[/expand]
Question 7: What is the importance of a candidate key in a database?
[expand title=View Answer] James P. Grant [/expand]
- A candidate key can be used to uniquely identify rows in a table.
- A candidate key can be used to encrypt data in a table.
- A candidate key can be used to drop a table.
Question 8: In the following student table, which attribute could be used as a primary key?
Student first name | Student last name | Mobile number |
Carl | Merlo | 07445532123 |
Mark | Nero | 07456532327 |
[expand title=View Answer] Mobile number [/expand]
Question 9: CREATE TABLE student is the right syntax to create a student table in SQL.
[expand title=View Answer] False [/expand]
Question 10: Choose the right syntax to create a club database in SQL. Select all correct answers.
[expand title=View Answer]
1.CREATE DATABASE CLUB
2.create database club
[/expand]
Week 2: Introduction to Databases Coursera Quiz Answers
Quiz 1: Self-review: Working with strings
Question 1: A college database contains a table called “Students” that has three columns: username, full name and email address. The username column contains alphanumeric values such as “St001” and has a fixed length of five characters. Select the correct SQL syntax for the username column.
[expand title=View Answer] username CHAR(5)[/expand]
Question 2: Which of the following SQL statements uses the right syntax to create the Student table in a college database with character limits?
[expand title=View Answer]CREATE TABLE students (username CHAR(5), fullName VARCHAR(100), email VARCHAR(255)); [/expand]
Question 3: You are sourcing feedback from students on college services. Each student can provide up to 10000 characters worth of feedback in an online form, which will then be stored in a database. Identify the correct SQL syntax to create the “Feedback” column.
[expand title=View Answer]article TEXT(10000) [/expand]
Question 4: TINYTEXT is a string data type used to define columns with small letter characters only.
[expand title=View Answer] False [/expand]
Quiz 2: Self-review: Working with default values
Question 1: A soccer club in London wants to create a table within their database to hold data on each player. Since most of the players are from London, the club can set “London” as the default value in the “City” column. Can you identify the correct SQL syntax to set London as the default value for this column?
[expand title=View Answer] City VARCHAR(30) DEFAULT “London” [/expand]
Question 2: The skill level of all new players within a soccer club must automatically be set at Level 1. Can you identify the correct SQL syntax to set each new player’s skill level using the DEFAULT keyword?
[expand title=View Answer] level INT DEFAULT 1; [/expand]
Question 3: The following SQL statement creates a table in a soccer club database called “Players”. It also adds two default values to the table: club with a default value of “Newport FC”, and city with a default value of “Newport”.
CREATE TABLE Players (playerName VARCHAR(50), club VARCHAR (10) DEFAULT “Newport FC”, city VARCHAR (100) DEFAULT “Newport”);
[expand title=View Answer] True [/expand]
Question 4: Database default constraints are used to limit the value of data that can be stored in a table.
[expand title=View Answer] True [/expand]
- False
- True
Question 5: You are creating a new members table in the sports club database. The table must have two columns with the following default values: city ‘London’ and gender ‘female’. How many instances of the DEFAULT keyword does your SQL statement require?
[expand title=View Answer] Two DEFAULT keywords.[/expand]
Quiz 3: Self-review: Choosing the right data type for a column
Question 1: A soccer club’s database includes a “Players” table. The table contains a “Player number” column that records the jersey number of each player in the team. Each jersey number is a whole number. Identify the correct data type for this column.
[expand title=View Answer]TINYINT [/expand]
Question 2: In a sports club database, the “Players” table includes a date of birth column that records the date of birth for each player. The right SQL data type to define the player date of birth is DOB VARCHAR(100).
[expand title=View Answer]False [/expand]
Question 3: Which one of the following SQL statements makes use of the correct data types to create a “Players” table in a soccer club’s database?
[expand title=View Answer] CREATE TABLE players (playerNumber INT, fullName VARCHAR(100), date_of_birth DATE); [/expand]
Question 4: A soccer club’s database includes a staff table with three columns: username, full name and title. The username contains alphanumeric values such as: “Staff001” and has a fixed length of eight characters. Select the right SQL syntax.
[expand title=View Answer]username CHAR(7) [/expand]
Question 5: The following SQL statement can be used to create a table called “Players”, with a default value of “Miami” for the city column.
CREATE TABLE players (playerName VARCHAR(100), city VARCHAR(50) DEFAULT “Miami”, age INT);
[expand title=View Answer] True [/expand]
Quiz 4: Self-review: Create a Database, create a table and insert data
Question 1: The following SQL statement can be used to create a database for a bookshop:
CREATE bookshop DATABASE
[expand title=View Answer] False [/expand]
Question 2: The following SQL statement can be used to create a “Customers” table in a bookshop database:
[expand title=View Answer]True [/expand]
CREATE TABLE customers (customerName VARCHAR(100), customerAddress VARCHAR(100))
Question 3: Identify the correct SQL command to insert a new record of data in a table.
[expand title=View Answer] INSERT INTO [/expand]
Question 4: Which of the following SQL statements can you use to insert a record for a customer named “Karl”, aged 21 into a table called “Customers”?
[expand title=View Answer]INSERT INTO customer (name, age) VALUES (“Karl”, 21);[/expand]
Question 5: Identify the missing keyword in the following SQL statement.
INSERT INTO customers (ID, name) ____ (7, “Tom”)
[expand title=View Answer]INSERT INTO customers (ID, name) VALUES (7, “Tom”) [/expand]
Quiz 5: Self-review: Practicing table creation
Question 1: Which of the following SQL syntax statements can you use to create a table? Select all that apply.
[expand title=View Answer]
1.create table table_name
2.CREATE TABLE table_name
[/expand]
Question 2: Select all steps to create a table in the database.
[expand title=View Answer]
1.Select a database.
2.Write the table name.
3.Use the CREATE TABLE command.
4.Define the columns of the table with relevant data types.
[/expand]
Question 3: Identify which of the following SQL statements can be used to create a table called “Products” for an online store. The table must contain two columns named “ID” and “Quantity.” The values within both columns must be whole numbers.
[expand title=View Answer] CREATE TABLE products (ID INT, quantity INT)[/expand]
Question 4: Which of the following SQL statements can be used to build a table that stores data about cell phone products?
[expand title=View Answer]CREATE TABLE cell_phone (name VARCHAR(100), productionDate DATE, price DECIMAL) [/expand]
Question 5: You need to create a table called “Players”. The table must contain two columns. The first column is called “playername” and holds the names of each player as a text data type. The second column is called “playerAge” and contains the age of each player as a whole number value. Identify the correct syntax to create this table.
[expand title=View Answer] CREATE TABLE Players (playerName VARCHAR(100), playerAge INT) [/expand]
Quiz 6: Knowledge check: Create, insert, and select
Question 1: The following SQL statement contains the syntax to create a product table with two columns ID and price:
CREATE TABLE product_table (ID, price)
[expand title=View Answer] False [/expand]
Question 2: You need to create a table for bank account records in a financial database. Which of the following SQL statements can you use to complete this task?
[expand title=View Answer] CREATE TABLE bank_account (account_number INT, balance Decimal ) [/expand]
Question 3: Select the right SQL statement to insert a new record of data into three columns of a table called “Games” with the following values:
GameID = 1, gameDate = 2022-10-10 and score = 3
[expand title=View Answer] INSERT INTO games (GameID, gameDate, score) VALUES (1, “2022-10-10”, 3); [/expand]
Question 4: A player with ID = 5, name = “Tina” and age = 23 must be added to the “Players” table for a soccer club database. Select the right SQL syntax to insert the player data into the table.
[expand title=View Answer] INSERT INTO Players (ID, name, age) VALUES (5, “Tina”, 23);[/expand]
Question 5: A hockey team requires all available data on their players for an upcoming meeting. Choose the correct SQL statement to select all data available in the players’ table
[expand title=View Answer] SELECT * FROM players;[/expand]
Quiz 7: Self-review: Record deletion
Question 1: The correct command to remove a record from a table is: DROP FROM
[expand title=View Answer]False [/expand]
Question 2: You can delete all records of data from a table without deleting the table itself using the SQL command DELETE FROM.
[expand title=View Answer]True [/expand]
Question 3: You can delete the record of the player assigned the number seven from the table “Players” using the following SQL syntax:
DELETE FROM players WHERE playerNumber = seven ;
[expand title=View Answer] False [/expand]
Question 4: You can delete all records from a table called “Players” where the value of City is equal to “London” using the following SQL syntax:
DELETE FROM players WHERE city = “London”
[expand title=View Answer] True [/expand]
Quiz 8: Knowledge check: Update and Delete
Question 1: Which of the following statements is the correct command syntax to update a table in SQL?
[expand title=View Answer] UPDATE table_name [/expand]
Question 2: What is the missing SQL keyword in the following SQL statement to update the customer’s table?
UPDATE Customers ___ ContactName = ‘Jack Molly’ WHERE CustomerID = 10;
[expand title=View Answer] SET [/expand]
Question 3: Which of the following SQL statements can be used to update data for a student in the “Students” table?
[expand title=View Answer] UPDATE students SET name = ‘Karl’ WHERE ID = 18; [/expand]
Question 4: The following table contains data about customers. The customer data should be removed completely, but without deleting the table. Identify which statement can be used to delete all records of data from the customer’s table without deleting the table itself.
Customer ID | Customer Name |
C1 | Karl |
C2 | Jack |
[expand title=View Answer] DELETE FROM customers; [/expand]
Question 5: The ‘WHERE’ keyword is used in SQL to specify a condition to update or delete data from a table.
[expand title=View Answer] True [/expand]
Quiz 9: Module quiz: Create, Read, Update and Delete (CRUD) Operations
Question 1: The following SQL clause creates a table named staff within a database:
CREATE staff TABLE;
[expand title=View Answer] False [/expand]
Question 2: The following SQL statement creates a table named staff, with two columns called name and address:
CREATE TABLE staff (name VARCHAR(100), address VARCHAR(100));
[expand title=View Answer] True[/expand]
Question 3: What is the SQL command to add a new record of data in the staff table?
[expand title=View Answer] INSERT INTO staff [/expand]
Question 4: Which is the right command syntax to update the staff table in SQL?
[expand title=View Answer] UPDATE Table staff [/expand]
Question 5: EDIT command is used to modify data in a database table.
[expand title=View Answer] False [/expand]
Question 6: Which one of the following SQL statements updates the staff email address for the individual named “Karl” in the staff table?
[expand title=View Answer]UPDATE staff SET email = ‘[email protected]’ WHERE name = ‘Karl’; [/expand]
Question 7: Select the right keyword to complete the missing part of the following statement:
INSERT INTO staff (ID, name) ___ (7, “Tom”);
[expand title=View Answer] VALUES[/expand]
Question 8: A staff table consists of three columns called name, email and age. Which of the following SQL statements selects all available data in all three columns in the staff table?
Select all correct answers.
[expand title=View Answer]
1.SELECT name, email, age FROM staff
2.SELECT * FROM staff
[/expand]
Question 9: The following SQL statement returns all staff phone numbers from the staff table:
SELECT phoneNumber FROM staff;
[expand title=View Answer] True [/expand]
Question 10: Which of the following SQL statements deletes all records of data from the staff table without deleting the table itself?
Select all correct answers.
[expand title=View Answer]
1.DELETE FROM staff
2.TRUNCATE TABLE staff
[/expand]
Week 3: Introduction to Databases Coursera Quiz Answers
Quiz 2: Self-review: ORDER BY and WHERE
Question 1: The ORDER BY keyword in SQL sorts the records of a table column in descending order by default.
[expand title=View Answer] False[/expand]
Question 2: The output result of the following SQL statement is the data of all customers from Germany, as “*” in this context means all columns.
SELECT * FROM customers WHERE Country = “Germany”;
[expand title=View Answer] True [/expand]
Question 3: Choose the SQL statement that shows a list of all customers who live in India organized alphabetically from A to Z within a database table named “customers”.
[expand title=View Answer] SELECT * FROM customers WHERE country = “India” ORDER BY FirstName ASC;
[/expand]
Question 4: Identify the effect of the following SQL statement on the “Staff” table:
SELECT * FROM staff ORDER BY Country, StaffName
[expand title=View Answer] Displays the results ordered by country first then staff name. [/expand]
Quiz 3: Module quiz: SQL operators and sorting and filtering data
Question 1: Which of the following SQL statements adds a $2.00 service fee to the total price in a table called “Orders”, that lists the price of orders customers placed with a store?
[expand title=View Answer]SELECT total + 2 FROM Orders; [/expand]
Question 2: What does the following SQL statement do?
[expand title=View Answer]
1.It returns the value of total price column in the second row.
2.It returns the result of total price divided by 2 for each cell in the total price column
[/expand]
Question 3: The following SQL statement returns 2 percent of the total price:
SELECT total % 2 FROM Orders;
[expand title=View Answer] False [/expand]
Question 4: Which of the following SQL statements returns 50% of the total price? Choose all correct answers.
[expand title=View Answer] SELECT total * 0.5 FROM Orders; [/expand]
Question 5: Select the right SQL statement to display the values of the total prices that are greater than $140.
[expand title=View Answer] SELECT total FROM Orders where total > 140 [/expand]
Question 6: Does the following SQL statements sort the result-set of the total prices in ascending or descending order?
SELECT * FROM Orders ORDER BY total;
[expand title=View Answer] Ascending [/expand]
Question 7: The following SQL statement filters data based on ____
SELECT * FROM customers WHERE Country = “Germany”;
[expand title=View Answer] ‘Country’ column with ‘Germany’ value [/expand]
Question 8: In SQL you can sort records in descending order using the DESCENDING keyword.
[expand title=View Answer] False [/expand]
Question 9: The output of the following SQL query within the Orders table is: UK, UK, UK, France, France, Finland
SELECT DISTINCT Country FROM Orders;
[expand title=View Answer] False[/expand]
Question 10: What does the following SQL statement do?
SELECT * FROM Orders ORDER BY country, total;
[expand title=View Answer] Orders the result by country first then total price.[/expand]
Week 4: Introduction to Databases Coursera Quiz Answers
Quiz 1: Knowledge check: Database schema
Question 1: he term database schema refers to the organization of data as a blueprint of how data should be organized and related.
[expand title=View Answer]True [/expand]
Question 2: Identify the essential parts of a database schema. Select all that apply.
[expand title=View Answer]
1.Tables
2.Relationships between tables
[/expand]
Question 3: A key advantage of a database conceptual schema is that it provides a clear view of how data is stored in database, which makes it easier to build and secure.
[expand title=View Answer] True [/expand]
Question 4: The primary key is used to connect tables in a database schema.
[expand title=View Answer] False [/expand]
Question 5: A bookstore schema including two tables: customers and orders, which are implemented as follows:
CREATE TABLE Customers( CustomerID int NOT NULL, Name VARCHAR(50), PRIMARY KEY (CustomerID));
CREATE TABLE Orders ( OrderID int NOT NULL, CustomerID int, PRIMARY KEY (OrderID), FOREIGN KEY (CustomerID) REFERENCES customers(CustomersID));
The two tables are connected through the OrderID attribute, because no order can be placed without a customer placing an order.
[expand title=View Answer]False [/expand]
Quiz 2: Knowledge check: Defining keys
Question 1: Which column can be used as the primary key in the following student table?
StudentName | Date Of Birth | |
Tim | 19/03/2000 | [email protected] |
Mark | 20/05/1999 | [email protected] |
Mark | 10/03/2001 | [email protected] |
Peter | 19/03/2000 | [email protected] |
[expand title=View Answer]Email [/expand]
Question 2: What type of primary key is used in the following Sales table?
Customer ID | Order ID | Product Code | Quantity |
Cu01 | Or10 | Pro123 | 10 |
Cu02 | Or11 | Pro153 | 12 |
Cu01 | Or10 | Pro124 | 16 |
Cu02 | Or12 | Pro123 | 11 |
[expand title=View Answer] A composite primary key represented by Customer ID and Product Code columns. [/expand]
Question 3: You need to create a table for staff members in a college. You must define the email address column as the primary key. Can the following SQL syntax be used to complete this task?
CREATE TABLE Staff( Email VARCHAR(200) NOT NULL, Name varchar(255) NOT NULL, CONSTRAINT PK_Email PRIMARY KEY (Email));
[expand title=View Answer]Yes [/expand]
Question 4: The following SQL code defines three primary keys: SalesID, CustomerID and ProductID.
CONSTRAINT SalesID PRIMARY KEY (customerID, proudctID)
[expand title=View Answer] False [/expand]
Question 5: Which of the following statements is the correct SQL syntax to define a foreign key that links the orders table with the customers table in the following diagram?
[expand title=View Answer]
CREATE TABLE Orders ( OrderID int NOT NULL, CustomerID int, PRIMARY KEY (OrderID), FOREIGN KEY (CustomerID) REFERENCES Customers(OrderID));
[/expand]
Quiz 3: Database relations and keys
Question 1: Identify the relationship between the following two tables (customer and order)
[expand title=View Answer] One-to-Many relationship [/expand]
Question 2: The following tables contain data about citizens and passports. Each citizen is permitted to own one passport. Identify the relationship between the two tables.
[expand title=View Answer] One-to-One relationship [/expand]
Question 3: The following ER diagram presents a many-to-many relationship between the actor entity and the movie entity.
[expand title=View Answer] False [/expand]
Question 4: The Customer ID in the Order table is a foreign key used to reference the primary key (customer ID) in the Customer table.
[expand title=View Answer] False[/expand]
Question 5: The entity relationship model is based on two key concepts: Entities and relationships
[expand title=View Answer] True [/expand]
Quiz 4: Knowledge Check: Database normalization
Question 1: Which of the following is a key aim of database normalization? Select all that apply.
[expand title=View Answer]
1.Minimize data duplication
2.Simplify data queries
3.Avoid errors during data modifications
[/expand]
Question 2: True or false. The first normal form allows for the storage of multiple values in table fields.
[expand title=View Answer] False [/expand]
Question 3: Partial Dependency occurs when a non-primary key attribute is functionally dependent on part of a composite key. This action violates which of the three normal forms?
[expand title=View Answer] Second normal form[/expand]
Question 4: True or false. Transitive dependency occurs when a non-key attribute determines the values of one or more other attributes, violating the third normal form criteria.
[expand title=View Answer]True [/expand]
Question 5: What actions should you take to ensure that a database is in first normal form? Select all that apply.
[expand title=View Answer]
1.Eliminate repeating groups of data within individual tables.
2.Create a separate table for each set of related data.
[/expand]
Quiz 5: Self-review: Database schema examples
Question 1: he table of data conforms with the first normal form.
[expand title=View Answer] False [/expand]
Question 2: What steps can you take to make sure that the table complies with the first normal form? Select all that apply.
[expand title=View Answer]
1.Assign a primary key to the table.
2.Decompose the table to avoid data redundancy.
[/expand]
Question 3: Assume that the table has been decomposed into two separate tables: “Departments” and “Courses”. Which attributes should be included in each of the new tables? Remember that the records of the two tables must be linked with a foreign key.
[expand title=View Answer]
The “Departments” table should include the department ID, name, and head of department. The “Courses” table should include the course ID, course name and department ID.
[/expand]
Question 4: After the normalization process is completed and the “College” table is decomposed into two tables called “Departments” and “Courses”. Which of the following two diagrams represents the correct schema?
[expand title=View Answer]Diagram 2. [/expand]
Question 5: Which of the following SQL statements can be used to create the Courses table in the new schema? Remember that the Courses table must be linked to the Departments table.
[expand title=View Answer] CREATE TABLE Courses (CouseID VARCHAR(5), CourseName VARCHAR(50), DepartmentID VARCHAR(10), PRIMARY KEY (CouseID), FOREIGN KEY (DepartmentID) REFERENCES Departments (DepartmentID)) [/expand]
Quiz 6: Module quiz: Database design
Question 1: A logical database schema introduces a blueprint of how the data is organized and related in tables.
[expand title=View Answer]True [/expand]
Question 2: Which column is the primary key in the following Patients table?
Patients | ||
Patient Name | Date Of Birth | |
Karl | 19/03/2000 | [email protected] |
Mark | 20/05/1999 | [email protected] |
Peter | 10/03/2001 | [email protected] |
Peter | 19/03/2000 | [email protected] |
[expand title=View Answer] Email [/expand]
Question 3: A foreign key is used to connect tables in a database.
[expand title=View Answer] True [/expand]
Question 4: The normalization process aims to reduce the negative effects of the different types of data anomalies.
[expand title=View Answer] True [/expand]
Question 5: Identify the issue with the following table of data in accordance with the rules of first normal form criteria
Department ID | Department Name | Director | Course ID | Course Name | Tutor ID | Tutor |
D1 | Computing | Dr Karl | C1 | Database | T1 | Mark |
D1 | Computing | Dr Karl | C2 | Python | T1 | Mark |
D1 | Computing | Dr Karl | C3 | Web | T2 | Jack |
D1 | Computing | Dr Karl | C4 | Java | T2 | Jack |
D2 | Math | Dr Mosa | C5 | Math | T3 | Rose |
[expand title=View Answer] Duplication of data.[/expand]
Question 6: To normalize the following table of data, you must decompose it into how many tables?
Department ID | Department Name | Director | Course ID | Course Name | Tutor ID | Tutor |
D1 | Computing | Dr Karl | C1 | Database | T1 | Mark |
D1 | Computing | Dr Karl | C2 | Python | T1 | Mark |
D1 | Computing | Dr Karl | C3 | Web | T2 | Jack |
D1 | Computing | Dr Karl | C4 | Java | T2 | Jack |
D2 | Math | Dr Mosa | C5 | Math | T3 | Rose |
[expand title=View Answer] Four tables (departments, directors, courses, and tutors). [/expand]
Question 7 : The table below contains a composite primary key made up of the columns “Tutor ID” and “Subject”. What kind of normalization problem does this composite key create?
Tutor ID | Subject | Credits |
T1 | Java | 20 |
T1 | Web | 15 |
T2 | Math | 15 |
T2 | History | 20 |
[expand title=View Answer] Second normal form partial dependency [/expand]
Question 8: Which of the following statements is the correct syntax to define a foreign key that links the “Players” and “Games” table in an ER diagram?
[expand title=View Answer] CREATE TABLE Games( gameID int NOT NULL, playerID int, PRIMARY KEY (gameID), FOREIGN KEY (playerID) REFERENCES players(playerID)); [/expand]
Question 9: A database relation is in second normal form if it is in first normal form and every non key attribute is __________ functionally dependent on the primary key.
[expand title=View Answer] Partially [/expand]
Question 10: Database normalization is a progressive process, which means that the database relation cannot be in the third normal form if it is not already applying the rules of the first and the second normal forms.
[expand title=View Answer] False[/expand]
Week 5: Introduction to Databases Coursera Quiz Answers
Quiz 1: Graded Assessment: Intro to Databases
Question 1: Write an SQL statement to create a database called “SportsClub”.
Answer: CREATE DATABASE SportsClub;
Question 2: In the text field below, input the missing keyword (___) from the following SQL statement to create a table called “Players”.
CREATE ____ Players (playerID INT, playerName VARCHAR(50), age INT, PRIMARY KEY(playerID));
[expand title=View Answer] CREATE TABLE Players (playerID INT, playerName VARCHAR(50), age INT, PRIMARY KEY(playerID));[/expand]
Run the complete SQL statement in MySQL to create the table in the club database.
Question 3: In the text field below, input the missing keyword (___) from the following SQL statement to insert data into the “Players” table.
INSERT INTO Players (playerID, playerName, age) ____ (1, “Jack”, 25);
[expand title=View Answer] INSERT INTO Players (playerID, playerName, age) VALUES (1, “Jack”, 25); [/expand]
Run the complete SQL statement in MySQL to insert the record of data in the players table.
Question 4: Insert three more records into the “Players” table that contain the following data:
- (2, “Karl”, 20)
- (3, “Mark”, 21)
- (4, “Andrew”, 22)
Once you have executed the INSERT INTO statement to enter these three records of data, run the following SQL statement:
SELECT playerName FROM Players WHERE playerID = 2;
What is the playerName that appears on the screen?
[expand title=View Answer] The playerName that appears on the screen is “Karl”.[/expand]
Question 5: Write a SQL statement that outputs all players names in the “Players” table. When you run the right SQL query, you should have the following output result:
[expand title=View Answer] James P. Grant [/expand]
Answer: SELECT playerName FROM Players;
Question 6: The following table called “Players”, contains four records of data. Write a SQL statement that updates the age of the player with ID = 3. The new age value should be ’22’.
[expand title=View Answer] UPDATE Players SET age = 22 WHERE playerID = 3; [/expand]
Question 7: The following table called “Players”, contains four records of data. Write a SQL statement that deletes the record of the player with ID = 4.
[expand title=View Answer] DELETE FROM Players WHERE playerID = 4; [/expand]
Question 8: Write an SQL statement that evaluates if the PlayerID in the following “Players” table is odd or even.
Hint: Assume X is a number. If the remainder of X divided by 2 is 0, then X is an even number otherwise X is an odd number. Remember to use the “%” symbol to get the remainder.
PlayerID | Name |
---|---|
1 | Karl |
2 | Adam |
3 | Anas |
[expand title=View Answer] SELECT PlayerID, CASE WHEN PlayerID % 2 = 0 THEN ‘Even’ ELSE ‘Odd’ END AS NumberType FROM Players; [/expand]
Question 9: Write an SQL statement that outputs all names of the players in the following “Players” table who are older than 25 years of age.
Age | Name |
---|---|
38 | Karl |
25 | Adam |
22 | Anas |
[expand title=View Answer] SELECT Name FROM Players WHERE Age > 25; [/expand]
Question 10: Review the following ER-Diagram. Write the missing part of the SQL statement to define a foreign key that links the course table with the department table.
CREATE TABLE Course( courseID int NOT NULL, courseName VARCHAR(50), PRIMARY KEY (courseID), ____ ____(____) ____ ____ (____) );
Hint: write only the missing part in your answer.
[expand title=View Answer] FOREIGN KEY (departmentID) REFERENCES Department(departmentID) [/expand]
Part 2 – Quiz
Question 11: What is a row of information about one specific staff member in a college database table referred to as?
[expand title=View Answer] A record [/expand]
Question 12: A sports club database includes a table called “Members” with two columns:
- A ‘member number’ column that contains the phone number of each member
- And a ‘full name’ column that contains the full name of each member.
Choose the right data type for each column. Select all correct answers.
[expand title=View Answer]
1.The Player number column data type is INT.
2.The Full name column data type is VARCHAR.
[/expand]
Question 13: In a football club the skill level of all new players must automatically be set at the default of level 1. Which SQL syntax is used to set this default level using the DEFAULT keyword?
[expand title=View Answer] level INT DEFAULT 1; [/expand]
Question 14: Database constraints are used to limit the type of data value that can be stored in a table.
[expand title=View Answer] True [/expand]
Question 15: The output result of the following SQL statement is the data of all customers from Italy.
SELECT * FROM customers WHERE Country = “Italy”;
[expand title=View Answer] True[/expand]
Question 16: The output result of the following SQL statement returns the records of all customers from India in Alphabetical order from A to Z.
SELECT * FROM students WHERE country = “India” ORDER BY FirstName DESC;
[expand title=View Answer] False [/expand]
Question 17: What does the following SQL statement do?
SELECT * FROM Players ORDER BY Country, PlayerName;
[expand title=View Answer] It displays the results ordered by country first, then players name. [/expand]
Question 18
The following table of data conforms with the first normal form.
Department ID | Department Name | Head of department | Course ID | Course Name |
D1 | Computing | Dr Karl | C1 | Database |
D1 | Computing | Dr Karl | C2 | Python |
D1 | Computing | Dr Karl | C3 | Web |
D1 | Computing | Dr Karl | C4 | Java |
D2 | Math | Dr Mosa | C5 | Math |
[expand title=View Answer] False [/expand]
Get All Weeks Meta Database Engineer Professional Certificate
Introduction to Databases Coursera Quiz Answers
Version Control Coursera Quiz Answers
Database Structures and Management with MySQL Quiz Answers
Advanced MySQL Topics Coursera Quiz Answers
Programming in Python Coursera Quiz Answers
Database Clients Coursera Quiz Answers
Advanced Data Modeling Coursera Quiz Answers