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.
- 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.
- 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
Write an SQL statement to create a database called “SportsClub”.
- CREATE DATABASE SportsClub;
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.
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.
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?
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;
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;
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;
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.
- SELECT PlayerID % 2 FROM Players;
Write an SQL statement that outputs all names of the players in the following “Players” table who are older than 25 years of age.
- SELECT Name FROM Players WHERE Age > 25;
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
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
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.
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;
Database constraints are used to limit the type of data value that can be stored in a table.
The output result of the following SQL statement is the data of all customers from Italy.
SELECT * FROM customers WHERE Country = "Italy";
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;
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.
The following table of data conforms with the first normal form.
|Department ID||Department Name||Head of department||Course ID||Course Name|
Which of the following represents the correct diagram that links the course table with the department table?
- Diagram 2
- Diagram 1
Identify the relationship between the tables in the diagram.
- Many to many relationship.
- One to one relationship.
- Many to one relationship.