Introduction to Databases | Week 5

Course Name: Introduction to Databases

Course Link: Introduction to Databases

These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Final graded quiz: Intro to databases

Q1. Write an SQL statement to create a database called “SportsClub”.

Answer:

create database SportsClub;

Q2. 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.

Answer:


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q3. 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.

Answer:


Q4. 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?

Answer:

Karl

These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q5. 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:

Answer:

SELECT playerName FROM Players;

Q6. 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’.

Answer:

UPDATE Players SET age = 22 WHERE playerID = 3;

These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q7. The following table called “Players”, contains four records of data. Write a SQL statement that deletes the record of the player with ID = 4.

Answer:

DELETE FROM Players WHERE playerID = 4;

Q8. 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.

PlayerIDName
1Karl
2Adam
3Anas

Answer:


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q9. Write an SQL statement that outputs all names of the players in the following “Players” table who are older than 25 years of age.

AgeName
38Karl
25Adam
22Anas

Answer:

SELECT Name FROM Players WHERE Age > 25;

Q10. 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.

Answer:

FOREIGN KEY (departmentID) REFERENCES Department(departmentID)

These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q11. What is a row of information about one specific staff member in a college database table referred to as?

  • A key
  • A column
  • A record

Answer: A record


Q12. 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 CHAR.
  • The Player number column data type is INT.
  • The Full name column data type is VARCHAR.

Answer: The Player number column data type is INT.
The Full name column data type is VARCHAR.


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q13. 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;

Answer: level INT DEFAULT 1;


Q14. Database constraints are used to limit the type of data value that can be stored in a table.

  • True
  • False

Answer: True


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q15. The output result of the following SQL statement is the data of all customers from Italy.
SELECT * FROM customers WHERE Country = “Italy”;

  • False
  • True

Answer: True


Q16. 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

Answer: False


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q17. 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.

Answer: It displays the results ordered by country first, then players name.


Q18. The following table of data conforms with the first normal form.

  • True
  • False

Answer: False


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera


Q19. Which of the following represents the correct diagram that links the course table with the department table?

  • Diagram 1
  • Diagram 2

Answer: Diagram 2


Q20. Identify the relationship between the tables in the diagram.

  • One to one relationship.
  • Many to one relationship.
  • Many to many relationship.

Answer: Many to one relationship.


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera

More Weeks of this course: Click Here

More Coursera Courses: http://progiez.com/coursera


These are answers of Introduction to Databases Week 5 Quiz Answers Coursera
The content uploaded on this website is for reference purposes only. Please do it yourself first.