Final graded quiz: Intro to databases Quiz Answers
In this article i am gone to share Coursera Course: Introduction to Databases for Back-End Development Final graded quiz: Intro to databases Quiz Answers with you..
Also visit: Module quiz: Database design Quiz Answers
Final graded quiz: Intro to databases Quiz Answers
This assessment consists of two parts: ode block and a quiz.
Part 1: Code Blocks
To complete this part of the assessment, you can use MySQL database management system available on the Coursera platform.
Instructions
- The questions in this assessment relate to a sports club that needs to build a digital database to maintain data about the players joining the club.
- Run each complete SQL statement you write in this part to develop the database for the sports club.
Important
- Remember to end each complete SQL statement with a semicolon.
- Make sure you leave a space between the SQL terms and the operators.
For example, a correctly formatted SQL statement must be written as follows:
- SELECT 5 + 7;
Here is an example of an incorrectly formatted SQL statement in which there is no semicolon, and no spaces are placed before or after the operator:
- SELECT 5+7
Part 1 – Quiz
Question 1)
Write an SQL statement to create a database called “SportsClub”.
- 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));
Run the complete SQL statement in MySQL to create the table in the club database.
- TABLE
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);
Run the complete SQL statement in MySQL to insert the record of data in the players table.
- VALUES
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?
- Karl
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:
- 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’.
- UPDATE Players SET age = 22 WHERE playerID = 3;
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.
- DELETE FROM Players WHERE playerID = 4;
Question 8)
Write an SQL statement that evaluates if the PlayerID in the following “Players” table is odd or even.
PlayerID | Name |
1 | Karl |
2 | Adam |
3 | Anas |
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.
- SELECT PlayerID % 2 FROM Players;
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 |
- SELECT Name FROM Players WHERE Age > 25;
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.
- FOREIGN KEY (departmentID) REFERENCES Department(departmentID)
Part 2 – Quiz
Question 11)
What is a row of information about one specific staff member in a college database table referred to as?
- A key
- A record
- A column
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.
- The Player number column data type is DECIMAL.
- The Full name column data type is VARCHAR.
- The Player number column data type is INT.
- The Full name column data type is CHAR.
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?
- DEFAULT level INT 1;
- level INT DEFAULT 1;
Question 14)
Database constraints are used to limit the type of data value that can be stored in a table.
- False
- True
Question 15)
The output result of the following SQL statement is the data of all customers from Italy.
SELECT * FROM customers WHERE Country = "Italy";
- False
- True
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;
- False
- True
Question 17)
What does the following SQL statement do?
SELECT * FROM Players ORDER BY Country, PlayerName;
- It orders the result by country and ignores the staff name.
- It displays the results ordered by country first, then players name.
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 |
- True
- False
Question 19)
Which of the following represents the correct diagram that links the course table with the department table?
- Diagram 2
- Diagram 1
Question 20)
Identify the relationship between the tables in the diagram.
- Many to many relationship.
- One to one relationship.
- Many to one relationship.