COURSE 7: WORKING WITH DATA IN ANDROID QUIZ ANSWERS
Week 3: Introduction to Databases & SQL
Meta Android Developer Professional Certificate
Complete Coursera Answers & Study Guide
Enroll in Coursera Meta Android Developer Professional Certification
INTRODUCTION
Practice applying asynchronous programming techniques to query REST APIs and handle their responses using Kotlin and Android.
Learning Objectives
- Explain what a database is, and what its general uses are.
- Explain how data is related in a database.
- Differentiate between types of databases.
- Apply the syntax rules of SQL to use common SQL comands.
KNOWLEDGE CHECK: INTRODUCTION TO SQL DATABASES
1. Which database model uses only tables to store data?
- Flat Files databases
- Relational databases (CORRECT)
- NoSQL databases
Correct! In relational databases all data must be stored in tables.
2. Which of the following is a key advantage of organizing data in tables?
- To provide a clear view of data (CORRECT)
- To store a large amount of data
- To protect data
Correct! Tables consists of rows and columns, which makes it easy to organize and understand data.
3. The SELECT command should be used to retrieve data from a database table. True or false?
- False
- True (CORRECT)
Correct! The SELECT command is used to select data from a database table. The data returned is stored in a result table, called the result-set.
4. Which SQL syntax should be used to create a student table?
- CREATE Student TABLE;
- CREATE TABLE Student; (CORRECT)
Correct! This is the only way to create a student table.
5. Choose the correct syntax to create a college database in SQL.
- CREATE College DATABASE;
- CREATE DATABASE College; (CORRECT)
Correct! The database name must follow the DATABASE keyword.
6. A company is developing an employee database. Which of the following items are examples of employee data that the company could collect and store in the database? Check all that apply
- Employee salaries (CORRECT)
- Employee home addresses (CORRECT)
- Employee names (CORRECT)
- Employee ID numbers (CORRECT)
Correct! This is an excellent example of data that could be collected and stored in a database. Data includes facts and figures on any aspect of employees the company requires.
That is correct! This is an excellent example of data that could be collected and stored in a database. Data includes facts and figures on any aspect of employees the company requires.
That’s correct! Employee names are an excellent example of data that could be collected and stored in a database. Data includes facts and figures on any aspect of employees the company requires.
You are correct! This is an excellent example of data that could be collected and stored in a database. Data includes facts and figures on any aspect of employees the company requires.
7. Can a primary key be used to identify a table field that contains unique values?
- Yes (CORRECT)
- No
Yes, a Primary Key field contains unique values that cannot be replicated elsewhere in the table. This avoids potential confusion between tables with similarities in data.
8. Is the SQL language used to interact with databases?
- No
- Yes (CORRECT)
Yes, SQL is used to interact with databases.
9. You are utilizing CRUD operations on the data in your database. Which of the following actions can you perform on the data using these operations? Check all that apply
- Create data (CORRECT)
- Read data (CORRECT)
- Update data (CORRECT)
- Delete data (CORRECT)
Creating data is a CRUD operation that can be performed using SQL.
Reading data is a CRUD operation that can be performed using SQL.
Updating data is a CRUD operation that can be performed using SQL.
Deleting data is a CRUD operation that can be performed using SQL.
10. You need to populate a table in your database. Which of the following SQL subsets should you use to add the data?
- Data Manipulation Language (CORRECT)
- Data Definition Language
- Data Query Language
Correct! You can populate a table with data using Data Manipulation Language.
11. You need to create a SQL Drop statement to remove a bookshop database. What is the correct syntax for this statement?
- DROP DATABASE bookshop_db; (CORRECT)
- Drop-database-bookshop-db;
- DROP_DATABASE_BOOKSHOP_DB;
Correct! This is the correct syntax for a SQL Drop statement.
SELF REVIEW: CREATE DATABASE AND CREATE TABLE
1. The following SQL statement can be used to create a database for a bookshop. True or false?
- CREATE bookshop DATABASE;
- False (CORRECT)
- True
Correct! This is not the right syntax to create the bookshop database in SQL. The name of the database should go after the keyword DATABASE.
2. Which SQL statement should you use to create a Customers table in a bookshop database?
CREATE TABLE customers
(
customerName VARCHAR(100)
customerAddress VARCHAR(100)
);
(CORRECT)
CREATE TABLE customers
(
customerName BOOLEAN
customerAddress VARCHAR(100)
);
Correct! This is the right syntax to create the Customers table in SQL.
3. When selecting the data type for the customer name, the CHAR type is the best choice. True or false?
- True
- False (CORRECT)
Correct! Names can have a random number of characters, so VARCHAR is better suited.
4. Which of the following could be said to be characteristics of a database table? Check all that apply.
- A table relates to other tables in the same database. (CORRECT)
- A table is structured as a series of rows and columns. (CORRECT)
- A table is a separate concept from an “object.”
- A table is sometimes also known as an “entity.” (CORRECT)
Correct. In a database that holds multiple tables, the tables are referred to as “relations” because they“relate” to one another.
Correct. Data in a table is organized into rows and columns.
Correct. A table also often referred to as an “entity” in a more logical sense.
5. You need to assign a data type to a table column that must contain whole numbers. Can you use the integer data type to complete this task?
- No
- Yes (CORRECT)
Yes, the integer data type is best suited to whole numbers.
6. You’re creating a new column within a table. Each entry in this column must be exactly 15 characters in length. Should you assign this column the string datatype of CHAR or VARCHAR?
- VARCHAR
- CHAR (CORRECT)
Yes, CHAR is the best option for this column because you have a predefined size of character that you want to maintain.
7. You are creating a table in a database. All fields in this table must contain a value, they cannot be left empty. Can you use a NOT NULL SQL statement to complete this task?
- Yes (CORRECT)
- No
Yes, a NOT NULL SQL statement is best suited to this task.
8. You are creating a table statement using SQL syntax. Which of the following best practices should you adhere to? Check all that apply.
- Assign the relevant data type to each column. (CORRECT)
- Separate each column with a comma. (CORRECT)
- Place all columns within a pair of parentheses. (CORRECT)
Correct! Each column in an SQL statement requires a data type such as VARCHAR or INT.
Correct! A comma must be placed at the end of each column in an SQL statement.
Correct! Columns in an SQL statement must be placed within a pair of parentheses.
9. You need to create an SQL ALTER table statement to add new students to a table in a college database. What is the correct syntax for writing the ALTER clause and table?
- ALTER_TABLE_STUDENT_TBL
- alter-table-student-tbl
- ALTER TABLE student_tbl (CORRECT)
Correct! This is the correct syntax for a SQL ALTER TABLE statement.
KNOWLEDGE CHECK: SETTING UP TABLES
1. What is the minimum number of tables that must be present in a relational database?
- Two tables
- Three tables
- One table (CORRECT)
Correct! A relational database must include at least one table. Otherwise, there will be no place to store data.
2. What is the name of the attribute that is chosen in the database to uniquely identify each record in a table?
- Secondary Key
- Primary Key (CORRECT)
- Foreign Key
Correct! The primary key includes unique values in each row and is used to identify each record of a table.
3. 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?
- CREATE ENTITY bank_account (account_number INT, balance DECIMAL);
- CREATE TABLE bank_account (account_number INT, balance DECIMAL); (CORRECT)
Correct! This is the right syntax to create the bank account table in SQL.
4. 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));
- No
- Yes (CORRECT)
Correct! The constraint has been used in a proper way to define the email address as a primary key.
5. A conceptual database schema defines three essential parts. Select all that apply.
- Attributes (CORRECT)
- Tables (CORRECT)
- Relationships (CORRECT)
Correct! Attributes define the information required in each table.
Correct! Tables are the main components of the database schema.
Correct! Relationships between tables show how data are related in the database.
SELF-REVIEW: RECORD DELETION
1. The correct command to remove a record from a table is: DROP FROM
- False (CORRECT)
- True
Correct! The DROP command is used to drop an existing database or a table in a database. The right command is DELETE FROM
2. You can delete all records of data from a table without deleting the table itself using the SQL command DELETE FROM.
- True (CORRECT)
- False
Correct! This SQL statement deletes all records of data from a table, without deleting the table.
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;
- False (CORRECT)
- True
Correct! The correct syntax to delete the record of data where the player number is 7 is: DELETE FROM players
WHERE playerNumber = 7;
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";
- True (CORRECT)
- False
Correct! This is the right SQL statement to delete all the records from the player’s table where the city = ‘London’.
5. You are creating an INSERT statement for a table in your database. Which of the following requirements should your syntax observe? Check all that apply.
- End your final row of values with a semi-colon. (CORRECT)
- Add a comma to the end of each row of values. (CORRECT)
- Place your columns within a pair of parentheses. (CORRECT)
Correct. It is important to place a semi-colon after the final row of values.
Correct. It is important to separate rows of values with a comma.
Correct. All column names must be contained within parentheses.
6. You need to query data from a column in a table within your database using a SELECT statement. What is the correct syntax for writing the SELECT statement?
- SELECT column FROM table; (CORRECT)
- SELECT_COLUMN_FROM_TABLE;
- Select-column-from-table;
Correct! This is the correct syntax for a SELECT statement.
7. You need to update records in a table using an UPDATE statement. Which one of the following clauses is used to specify the location in the table where the update must take place?
- WHERE
- UPDATE
- SET (CORRECT)
Correct! The SET clause specifies the location of the records within the table.
8. You need to create a DELETE statement to remove records from a table. What is the correct syntax for this statement?
- DELETE FROM table_name; (CORRECT)
- DELETE-FROM-TABLE-NAME;
- DELETE_FROM_TABLE_NAME;
Correct! This is the correct syntax for a DELETE statement.
KNOWLEDGE CHECK: WORKING WITH DATA IN SQL
1. Which of the following statements presents the correct command syntax for updating a table in SQL?
- UPDATE column
- UPDATE table_name (CORRECT)
- UPDATE Table table_name
Correct! This is the right way to use the UPDATE command where table_name concludes the command.
2. What is the missing SQL keyword in the following SQL statement that is used to update the Customers table?
- UPDATE Customers … ContactName = ‘Jack Molly’ WHERE CustomerID = 10;
- INSERT
- ANY
- SET (CORRECT)
Correct! SET is the right keyword in SQL to update the contact name with a new value.
3. Which of the following SQL statements can be used to update data for a student in the Students table?
- UPDATE students SET name = ‘Karl’ AND ID = 18;
- UPDATE students WHERE ID = 18 SET name = ‘Karl’;
- UPDATE students SET name = ‘Karl’ WHERE ID = 18; (CORRECT)
Correct! This is the right syntax to update the student’s name in the Students table.
4. The following table contains data about customers.

- The customer data should be removed completely, but without deleting the table.
- Which statement can be used to delete all data records from the customers’ table without deleting the table itself?
- DELETE FROM customers; (CORRECT)
- DROP TABLE customers
Correct! This SQL statement deletes all rows in the Customers table, without deleting the table itself.
5. The WHERE keyword is used in SQL to specify a condition to update or delete data from a table. True or false?
- True (CORRECT)
- False
Correct! WHERE is used to identify those records that fulfil a specified condition.
MODULE QUIZ: INTRODUCTION TO DATABASES & SQL
1. The following SQL statement creates a table named staff within a database:
True or false?
CREATE staff TABLE
- False (CORRECT)
- True
Correct! The table name should be written after the TABLE keyword.
2. The following SQL statement creates a table named staff, with two columns called name and address:
True or false?
CREATE TABLE staff (name VARCHAR(100), address VARCHAR(100));
- True (CORRECT)
- False
Correct! This is the right syntax to create the staff table with name and address columns in SQL.
3. What is the SQL command to add a new record of data in the staff table?
- INSERT TO staff
- INSERT INTO staff (CORRECT)
- ADD INTO staff
Correct! The INSERT INTO command is used to insert new records in a table.
4. Which is the right command syntax to update the staff table in SQL?
- UPDATE Table staff
- Table staff UPDATE
- UPDATE staff (CORRECT)
Correct! This is the right syntax.
5. The EDIT command is used to modify data in a database table. True or false?
- True
- False (CORRECT)
Correct! The UPDATE command is used to modify data in the database.
6. Which one of the following SQL statements updates the email address for the individual named Karl in the staff table?
- UPDATE staff SET email = ‘Karl@email.com’ WHERE ID = 16; (CORRECT)
- UPDATE students SET name = ‘Karl@email.com’ WITH ID = 16;
- UPDATE staff WHERE ID = 16 SET email = ‘Karl@email.com’;
Correct! This is the right syntax to update the email address for Karl in the staff table.
7. Select the right keyword to complete the missing part of the following statement:
INSERT INTO staff (ID, name) ... (7, “Tom”)
- VALUES (CORRECT)
- DATA
- COLUMN
Correct. VALUES is the correct SQL keyword to use here to insert a new record in the staff table.
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 that apply:
- SELECT * FROM staff (CORRECT)
- SELECT name, email, age FROM staff (CORRECT)
- SELECT name, email AND age FROM staff
Correct! You can use this syntax to select all the columns available in the staff table.
Correct! You can use this syntax to select all the columns available in the staff table.
9. The following SQL statement returns all staff phone numbers from the staff table:
True or false?
Select phoneNumber from staff
- True (CORRECT)
- False
Correct! This is the right SQL statement to return the staff phone numbers.
10. Which of the following SQL statements deletes all records of data from the staff table without deleting the table itself? Select all that apply:
- DELETE FROM staff (CORRECT)
- TRUNCATE TABLE staff (CORRECT)
- DROP TABLE staff
Correct! This SQL statement deletes all rows in the staff table without deleting the table.
Correct! This SQL statement deletes all rows in the staff table without deleting the table.
CONCLUSION
tbw
Subscribe to our site
Get new content delivered directly to your inbox.
Quiztudy Top Courses
Popular in Coursera
- Meta Marketing Analytics Professional Certificate.
- Google Digital Marketing & E-commerce Professional Certificate.
- Google UX Design Professional Certificate.
- Meta Social Media Marketing Professional Certificate
- Google Project Management Professional Certificate
- Meta Front-End Developer Professional Certificate
Liking our content? Then, don’t forget to ad us to your BOOKMARKS so you can find us easily!