Mysql

When you have a subquery inside of the main query, which query is executed first?

1.

The subquery is never executed. Only the main query is executed.

2.

They are executed at the same time

3.

the main query

4.

the subquery

Q 1 / 96

Mysql

You need to export the entire database, including the database objects, in addition to the data. Which command-line tool do you use?

1.

mysqlexport

2.

mysqladmin

3.

mysqldump

4.

mysqld

Q 2 / 96

Mysql

You must ensure the accuracy and reliability of the data in your database. You assign some constraints to limit the type of data that can go into a table. What type of constraints are you assigning?

1.

row level

2.

database level

3.

column level

4.

function level

Q 3 / 96

Mysql

Which option of most MySQL command-line programs can be used to get a description of the program's different options?

1.

--options

2.

?

3.

--help

4.

-h

Q 4 / 96

Mysql

MySQL uses environment variables in some of the programs and command-line operations. Which variable is used by the shell to find MySQL programs?

1.

DIR

2.

HOME

3.

PATH

4.

MYSQL_HOME

Q 5 / 96

Mysql

How can you create a stored procedure in MySQL?

1 CREATE PROCEDURE P () AS 2 BEGIN 3 END; 1 CREATE PROCEDURE P () 2 BEGIN 3 END 1 CREATE PROCP 2 BEGIN 3 END; 1 CREATE PROC P AS O 2 BEGIN 3 END;

1.

A

2.

B

3.

C

4.

D

Q 6 / 96

Mysql

If you were building a table schema to store student grades as a letter (A, B, C, D, or F) which column type would be the best choice?

1.

ENUM

2.

OTEXT

3.

VARCHAR

4.

LONGTEXT

Q 7 / 96

Mysql

Management has requested that you build an employee database. You start with the employee table. What is the correct syntax?

1 CREATE TABLE employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY ON employeeID 8 ); 1 CREATE TABLE employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY employeeID 8 ); 1 CREATE TABLE IF EXISTS employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY (employeeID) 8 ); sql 1 CREATE TABLE IF NOT EXISTS employee ( 2 employee ID char(10), 3 firstName varchar(50), 4 lastName varchar(50), 5 phone varchar(20), 6 address varchar(50), 7 PRIMARY KEY (employeeID) 8 );

1.

A

2.

B

3.

C

4.

D

Q 8 / 96

Mysql

You are working with the tables as shown in this diagram. You need to generate the list of customers who purchased certain car models. Which SQL clause do you use?

![mysql Q09](images/mysql_q09.jpg)

1.

LIKE

2.

IN

3.

BETWEEN

4.

HAVING

Q 9 / 96

Mysql

Which query would NOT be used to administer a MySQL server?

1.

USE db

2.

SELECT column FROM tbl

3.

SHOW COLUMNS FROM tbl

4.

SHOW TABLES

Q 10 / 96

Mysql

What is the product of the database designing phase?

`Logical, physical and normalized are all products of the designing phase in this order.`

1.

system definition

2.

logical model

3.

physical model

4.

normalized database

Q 11 / 96

Mysql

MySQL server can operate in different SQL modes, depending on the value of the sql_mode system variable. Which mode changes syntax and behavior to conform more closely to standard SQL?

1.

TRADITIONAL

2.

ANSI

3.

MSSQL

4.

STRICT

Q 12 / 96

Mysql

MySQL programs are a set of command-line utilities that are provided with typical MySQL distributions. MySQL is designed to be a database.

1.

database and programming

2.

user and administrator

3.

client and server

4.

syntax and objects

Q 13 / 96

Mysql

Which MySQL command shows the structure of a table?

1.

INFO table;

2.

SHOW table;

3.

STRUCTURE table;

4.

DESCRIBE table;

Q 14 / 96

Mysql

MySQL uses security based on _ for all connections, queries, and other operations that users can attempt to perform.

1.

administrator schema

2.

encrypted algorithms

3.

user settings

4.

access control lists

Q 15 / 96

Mysql

Which MySQL command modifies data records in a table?

1.

UPDATE

2.

MODIFY

3.

CHANGE

4.

ALTER

Q 16 / 96

Mysql

What is the best type of query for validating the format of an email address in a MySQL table?

1.

a SQL query using partitions

2.

a SQL query using IS NULL

3.

a SQL query using a regular expression

4.

a SQL query using LTRIM Or RTRIM

Q 17 / 96

Mysql

In MySQL, queries are always followed by what character?

1.

line break

2.

colon

3.

semicolon

4.

period

Q 18 / 96

Mysql

How can you remove a record using MySQL?

1.

DELETE

2.

DELETE FROM

3.

REMOVE

4.

REMOVE FROM

Q 19 / 96

Mysql

Which choice is NOT a statement you would use to filter data?

1.

GROUP_BY

2.

WHERE

3.

LIMIT

4.

LIKE

Q 20 / 96

Mysql

What does the following SQL statement return?

`SELECT * FROM Employees WHERE EmployeeName LIKE 'a%'`

1.

It records in the Employees table where the value in the EmployeeName column doesn't have an "a".

2.

It records in the Employees table where the value in the EmployeeName column starts with "a".

3.

It records in the Employees table where the value in the EmployeeName column has an "a".

4.

It records in the Employees table where the value in the EmployeeName column ends with "a".

Q 21 / 96

Mysql

In `SELECT * FROM clients;` what does clients represent?

1.

a SQL query

2.

a SQL statement

3.

a database

4.

a table

Q 22 / 96

Mysql

How does MySQL differ from SQL?

1.

SQL is a standard language for retrieving and manipulating data from structured databases. MySQL is a nonrelational database management system that is used to manage SQL databases.

2.

SQL is a standard language for retrieving and manipulating data from structured databases. MySQL is a relational database management system that is used to manage SQL databases.

3.

They are not different. MySQL and SQL refer to the same thing.

4.

My SQL is a language, and SQL is a software application.

Q 23 / 96

Mysql

If you need to order a table of movies by name, which query will work?

1.

SELECT * FROM movies GROUP BY name

2.

SELECT * FROM movies ORDER BY name

3.

SELECT * FROM movies ORDER TABLE by name

4.

SELECT * FROM movies FILTER BY name

Q 24 / 96

Mysql

A trigger is a database object that is associated with a table, and that activates when a particular event occurs for the table. Which three events are these?

1.

INSERT, UPDATE, DELETE

2.

CREATE, ALTER, DROP

3.

OPEN, FETCH, CLOSE

4.

DECLARE, SET, SELECT

Q 25 / 96

Mysql

You are working with very large tables in your database. Which SQL clause do you use to prevent exceedingly large query results?

1.

UNIQUE

2.

LIMIT

3.

DISTINCT

4.

CONSTRAINT

Q 26 / 96

Mysql

What is the default port for MySQL Server?

1.

25

2.

990

3.

0

4.

3306

Q 27 / 96

Mysql

How can you filter duplicate data while retrieving records from a table?

1.

DISTINCT

2.

WHERE

3.

LIMIT

4.

AS

Q 28 / 96

Mysql

What is the difference between DROP and TRUNCATE?

1.

They both refer to the same operation of deleting the table completely.

2.

They both refer to the same operation of clearing the table, but keeping its definition intact.

3.

TRUNCATE deletes table completely, removing its definition as well. DROP clears the table but does not delete the definition.

4.

DROP deletes table completely, removing its definition as well. TRUNCATE clears the table but does not delete the definition.

Q 29 / 96

Mysql

How do you select every row in a given table named "inventory"?

1.

SELECT all FROM inventory;

2.

FROM inventory SELECT all;

3.

FROM inventory SELECT *;

4.

SELECT * FROM inventory;

Q 30 / 96

Mysql

In an efficiently designed relational database, what does every table have?

1.

set of triggers

2.

sequential id field

3.

minimum of three columns

4.

primary key

Q 31 / 96

Mysql

MySQL option files provide a way to specify commonly used options so that they need not be entered on the command line each time you run a program. What is another name for the option files?

1.

variable settings

2.

configuration files

3.

help files

4.

default settings

Q 32 / 96

Mysql

After installing MySQL, it may be necessary to initialize the _ which may be done automatically with some MySQL installation methods.

1.

storage engine

2.

user accounts

3.

grant tables

4.

data directory

Q 33 / 96

Mysql

You need to export the data in the customers table into a CSV file, with columns headers in the first row. Which clause do you add to your MySQL command?

1.

JOIN

2.

WITH HEADERS

3.

UNION

4.

WITH COLUMNS

Q 34 / 96

Mysql

One form of backup, replication, enables you to maintain identical data on multiple servers, as a _ configuration.

1.

remote-local

2.

parent-child

3.

master-slave

4.

logical-physical

Q 35 / 96

Mysql

What is the requirement for using a subquery in the SELECT clause?

1.

the subquery must use an aggregate function.

2.

the subquery must refer to the same table as the main query.

3.

the subquery must return a single value.

4.

the subquery must return at least one value.

Q 36 / 96

Mysql

Each time MySQL is upgraded, it is best to execute mysql_upgrade, which looks for incompatibilities with the upgraded MySQL server. What does this command do, upon finding a table with a possible incompatibility?

1.

it performs a table check and, if problems are found, attempts a table repair.

2.

it stops and notifies the server administrator that the upgrade cannot complete until the incompatibility issue are resolved.

3.

it provides a full report of the table specifications and the incompatibilities to the server administrator.

4.

it performs a table check and, if problems are found, displays the information for the server administrator to take action.

Q 37 / 96

Mysql

What mysql statement is used to check which accounts have specific privileges?

1.

show grants (displays the privileges and roles that are assigned to a MySQL user account or role)

2.

show privileges (shows the list of system privileges that the MySQL server supports)

3.

show access

4.

show user permissions

Q 38 / 96

Mysql

What table cannot have a trigger associated with it?

1.

temporary

2.

system

3.

large

4.

new

Q 39 / 96

Mysql

later versions of mysql support the native json data type for storing json documents. What is a drawback of json columns?

1.

inefficient for storing json documents

2.

cannot be indexed directly

3.

documents cannot be validated when stored in json columns

4.

cannot be normalized

Q 40 / 96

Mysql

undefined

![mysql Q41](images/mysql_q41.jpg)

1.

carid is the primary key for purchases

2.

carid is the foreign key for cars.carid

3.

customerid is the foreign key for customers.id

4.

customerid is the primary key for purchases

Q 41 / 96

Mysql

undefined

1.

cat file|mysql

2.

load data infile (correct if the file is already on the server)

3.

load data local infile (also correct but only if the file is from the client)

4.

extended insert statement

Q 42 / 96

Mysql

See tables in the diagram. Make sure that any record added to the purchase table consists of a customerId, which exists in the customer table and a carId, which exists in the car table. You decide to use a trigger to do the validation. Which one?

![mysql Q43](images/mysql_q43.jpg)

1.

after insert

2.

if exists (invalid not a trigger; IF function + EXISTS clause)

3.

before insert

4.

cross join (valid for a check but not a trigger)

Q 43 / 96

Mysql

Which is the correct syntax of an extended insert statement?

('Mercedes', 'C', 2003) values ('Mercedes', 'C', 2003) ('Mercedes', 'C', 2003) ('Mercedes', 'C', 2003)

1.

insert into cars (make, model, year) values ('Ford', 'Mustang', 2002)

2.

insert into cars (make, model, year) values ('Ford', 'Mustang', 2002)

3.

insert into cars (make, model, year) extended ('Ford', 'Mustang', 2002),

4.

insert into cars (make, model, year) values ('Ford', 'Mustang', 2002),

Q 44 / 96

Mysql

You need to make an exact copy of a table, with all columns and indexes. How can you get all of the information needed to accomplish this?

Note that the question is about _getting_ the data and not about the _duplicating_ operation itself. And actually there is no need to run `SHOW CREATE TABLE` at all. [To duplicate the table](https://popsql.com/learn-sql/mysql/how-to-duplicate-a-table-in-mysql) structure you can `CREATE TABLE new_table LIKE original_table;`.

1.

create table

2.

clone table

3.

insert into

4.

show create table

Q 45 / 96

Mysql

you need to make your mysql system secure against attackers. What are you _not_ supposed to do?

1.

Run MySQL server as a normal user.

2.

Grant PROCESS or SUPER privilege to other users.

3.

Run MySQL server as the unix root user.

4.

Use the compressed protocol.

Q 46 / 96

Mysql

You manage a database with a table "customers". You created a temporary table also called "customers" with which you are working for the duration of your session. You need to recreate the temporary table with different specs. Which command do you need to run first?

1.

`create temporary table customers;`

2.

`drop temp table customers;`

3.

`drop table customers;`

4.

`drop temporary table customers;`

Q 47 / 96

Mysql

You need to run a complex query with recursive subqueries, but without creating a stored procedure or a function. Which command or clause do you use?

This is exactly what [WITH clause](https://dev.mysql.com/doc/refman/8.0/en/with.html) is designed for

1.

COLLATE

2.

UNION

3.

FULL JOIN

4.

WITH

Q 48 / 96

Mysql

Which choice is not a processing algorithm for database views?

1.

merge

2.

updatable

3.

temptable

4.

undefined

Q 49 / 96

Mysql

What is the MySQL `perror` command-line utility used for?

Note: perror prints a description for a system error code or for a storage engine (table handler) error code -

1.

to display your version of MySQL

2.

to display operating system error codes

3.

to display default settings that are in error

4.

to display storage error codes

Q 50 / 96

Mysql

How can you list all columns for a given table?

Note: `DESCRIBE tablename` is a shortcut for this command

1.

SHOW table COLUMNS;

2.

SHOW COLUMNS FROM table;

3.

LIST table COLUMNS;

4.

SELECT COLUMNS FROM table;

Q 51 / 96

Mysql

How would you list the full set of tables in the currently selected database?

1.

SELECT * FROM DATABASE;

2.

SHOW TABLES;

3.

LIST TABLES;

4.

SELECT ALL TABLES;

Q 52 / 96

Mysql

Which choice is not one of the table maintenance statements?

1.

CHECK TABLE;

2.

CREATE TABLE;

3.

ANALYZE TABLE;

4.

OPTIMIZE TABLE;

Q 53 / 96

Mysql

In which table does MySQL store passwords for user accounts?

1.

mysql.accounts;

2.

mysql.passwords;

3.

mysql.admin;

4.

mysql.user;

Q 54 / 96

Mysql

Management has requested that you build an employee database. You need to include each employee's current position and salary, as well as all prior positions and salaries with the company. You decide to use a one-to-many structure: an employee table with the main information such as name and address, and an employment table with position and salary history. You can use the employeeID field to connect them. What is employment.employeeID an example of?

1.

primary key;

2.

secondary key;

3.

foreign key;

4.

alternate key;

Q 55 / 96

Mysql

In recent versions of MySQL (8.0+), what's the correct syntax to declare a CTE (Common Table Expression)?

1.

WITH (SELECT id FROM users) as cte, SELECT ...

2.

WITH (SELECT id FROM users) as cte SELECT ...

3.

WITH cte as (SELECT id FROM users), SELECT ...

4.

WITH cte as (SELECT id FROM users) SELECT ...

Q 56 / 96

Mysql

What is one reason to introduce data redundancy into a normalized database design?

Note: "to make the system faster" can also be correct. For example we can calculate some heavy query in advance and store its result in some column (use it as a cache). So if "system" means "application which uses mysql" then it's correct too.

1.

to reduce corruption in data

2.

to reduce storage space

3.

to make the system faster

4.

to prevent data anomalies

Q 57 / 96

Mysql

The code snippet below is used to read data from an XML file into a table. Which XML structure is _not_ supported by the statement?

mysql LOAD XML LOCAL INFILE 'cars.xml' INTO TABLE cars ROWS IDENTIFIED BY `<car>`; xml <car> <field name="make"> Lexus </field> <field name="model"> IS300 </field> <field name="make"> 2016 </field> </car> xml <car name="make"> Dodge </car> <car name="model"> Ram </car> <car name="year"> 2000 </car> xml <car make="Ford" model="Mustang" year="2002"/> xml <car year="2010"> <make>Mercedes</make> <model> C-Class</model> </car>

1.

A

2.

B

3.

C

4.

D

Q 58 / 96

Mysql

You are loading data into a table. Which command can you use to make sure that all data is inserted and duplicated rows are discarded?

1.

`INSERT IGNORE`

2.

`INSERT UNIQUE`

3.

`INSERT INTO`

4.

`INSERT DISTINCT`

Q 59 / 96

Mysql

Which statement about the `TRUNCATE TABLE` statement is true?

Note: both answers are correct - see [TRUNCATE TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html) in MySQL manual

1.

It will stop and issue an error when it encounters a row that is referenced by a row in a child table.

2.

It always first drops, then re-creates a new table.

3.

It deletes rows one by one on tables with foreign key constraints.

4.

It does not invoke the `DELETE` triggers associated with the table.

Q 60 / 96

Mysql

You are working with the tables as shown in this diagram. You need to get the number of cars sold per the home state of each customer's residence. How can you accomplish this?

![mysql Q61](images/mysql_q61.png) Explanation: THe difference between 2 and 3 is that LEFT JOIN will return 1 row per customer before grouping. If replaced with RIGHT JOIN it would return the correct info.

1.

`SELECT state, COUNT(*) FROM customers WHERE ID IN (SELECT customerID FROM purchases) GROUP BY state;`

2.

`SELECT state, COUNT(*) FROM customers c LEFT JOIN purchases p ON c.ID = p.customerID GROUP BY state;`

3.

`SELECT state, COUNT(*) FROM customers c, purchases p WHERE c.ID = p.customerID GROUP BY state;`

4.

`SELECT state, COUNT(*) FROM customers GROUP BY state;`

Q 61 / 96

Mysql

In data migration, there is often a need to delete duplicate rows as part of data cleanup. Which statement works best?

1.

`DELETE DUPS`

2.

`DELETE DISTINCT`

3.

`DELETE JOIN`

4.

`DELETE WITH`

Q 62 / 96

Mysql

When working with MySQL cursor, what must you also declare?

1.

`DEFAULT` value

2.

`RETURN` variable

3.

`SQLEXCEPTION` routine

4.

`NOT FOUND` handler

Q 63 / 96

Mysql

Which type of backup includes all the changes made to the data since the last full backup was performed?

1.

snapshot

2.

logical

3.

differential

4.

incremental

Q 64 / 96

Mysql

You need to restore a MySQL database from a backup file. Which command-line tool do you use for the actual data import, after re-creating the database?

1.

`mysqld`

2.

`mysql`

3.

`mysqladmin`

4.

`mysqldump`

Q 65 / 96

Mysql

You are importing data as JSON into a new table. You run CREATE TABLE json_data ( city JSON ); and insert rows into this table. What is the correct syntax to see the list of cities?

Note: the last option is valid too but the results will be enclosed with quotation marks

1.

`SELECT city FROM json_data;`

2.

`SELECT city->>'$.name' city FROM json_data;`

3.

`SELECT city.name city FROM json_data;`

4.

`SELECT city->'$.name' city FROM json_data;`

Q 66 / 96

Mysql

If you want to use MyISAM instead of InnoDB, which option do you need to specify in the CREATE TABLE statement?

1.

ENGINE

2.

PARTITION

3.

STORAGE

4.

TABLESPACE

Q 67 / 96

Mysql

You are working with the table in this diagram. You want to use full-text search to find the customers who live on a street or a drive. What is the command to do that?

Table name: customers | ID | lastname | firstname | phone | address | city | state | zip | | ---- | -------- | --------- | ------------ | ------------------- | ----------- | ----- | ----- | | A001 | Smith | Bob | 212-555-1212 | 1001 1st Street | New York | NY | 10001 | | A002 | Chang | John | 213-555-5678 | 888 Rodeo Drive | Los Angeles | CA | 90210 | | A003 | Smith | Mary | 999-999-9999 | 123 Main Street | Anytown | VA | 12345 | | A004 | Johnson | Jack | 312-312-3120 | 1111 Chicago Avenue | Chicago | IL | 60606 | | A005 | Lopez | Linda | 737-777-3333 | 123 Main Street | Austin | TX | 73344 | sql SELECT * FROM customers WHERE address MATCH 'Street' OR 'Drive'; sql SELECT * FROM customers WHERE MATCH(address) IN ('street, drive'); sql SELECT * FROM customers WHERE address MATCH 'Street' OR address MATCH 'Drive'; sql SELECT * FROM customers WHERE MATCH(address) AGAINST ('street, drive');

1.

A

2.

B

3.

C

4.

D

Q 68 / 96

Mysql

Which query lists the databases on the current server?

1.

SHOW DATABASES;

2.

LIST ALL DATABASES;

3.

LIST DATABASES;

4.

SHOW DB;

Q 69 / 96

Mysql

What is the product of the database designing phase?

1.

all tables, columns, data types, indexes and their relationships

2.

a list of entities, their relationship, and constraints

3.

all tables and their names, which are needed to implement the logical model

4.

a list of entities, their relationship, constraints, data types, and cardinalities

Q 70 / 96

Mysql

Which choice is _not_ a valid model for a stored procedure parameter?

1.

INOUT

2.

IN

3.

OUT

4.

IN OUT

Q 71 / 96

Mysql

What is the advantage of using a temporary table instead of a heap table?

1.

The temporary table will be dropped when the database is restarted.

2.

Temporary tables can be shared among clients, which makes them more usable in group development environments.

3.

The temporary table will be dropped as soon as your session disconnects.

4.

Creating a temporary table does not require any special privileges.

Q 72 / 96

Mysql

Which is a valid constructor for a class named User?

1.

`public construct User() {}`

2.

`public User() {}`

3.

`public instance User() {}`

4.

`public init User() {}`

Q 73 / 96

Mysql

What is the maximum number of columns that can be used by a single table index?

1.

2

2.

4

3.

8

4.

16

Q 74 / 96

Mysql

Which command will return a list of triggers in the current database?

1.

`DISPLAY TRIGGERS;`

2.

`SHOW TRIGGERS;`

3.

`SELECT ALL TRIGGERS;`

4.

`SELECT * FROM information_schema.triggers;`

Q 75 / 96

Mysql

Which statement is true about TIMESTAMP and DATETIME data types?

1.

TIMESTAMP values require more bytes for storage than DATETIME values.

2.

TIMESTAMP is stored without timezone, and DATETIME is stored in UTC values.

3.

TIMESTAMP and DATETIME are both stored without time zone.

4.

TIMESTAMP is stored in UTC values, and DATETIME is stored in without time zone.

Q 76 / 96

Mysql

What is the equivalent of the mysqladmin reload command?

1.

`mysqladmin flush-threads`

2.

`mysqladmin flush-tables`

3.

`mysqladmin flush-privileges`

4.

`mysqladmin flush-all`

Q 77 / 96

Mysql

Explain the security aspect of stored procedures

1.

Stored procedures are not secure, because they can be executed from the command line as the root user

2.

Stored procedures are secure, because the owner of the stored procedure can decide to whom access is granted

3.

Stored procedures are secure, because applications can be given access to stored procedures and not any underlying variables

4.

Stored procedures are not secure, because they can execute statements to drop tables or bulk delete data

Q 78 / 96

Mysql

How would you retrieve data on all the customers where no phone number is stored?

1.

`SELECT * FROM customers WHERE PhoneNumber = NULL;`

2.

`SELECT * FROM customers WHERE PhoneNumber IS NOT VALID;`

3.

`SELECT * FROM customers WHERE PhoneNumber IS NULL;`

4.

`SELECT * FROM customers WHERE PhoneNumber IS UNKNOWN;`

Q 79 / 96

Mysql

In the diagram below, the price field is declared as type DECIMAL. What would be a more efficient declaration for this field?

![mysql picture](images/mysql_q80.png)

1.

FLOAT

2.

DECIMAL(10,2)

3.

NUMERIC

4.

DOUBLE

Q 80 / 96

Mysql

Which choice is `not` an available string type for a column?

Explnation: BIT is not a string type

1.

`ENUM`

2.

`SET`

3.

`BIT`

4.

`CHAR`

Q 81 / 96

Mysql

This diagram shows what type of relationship between customers and cars?

![mysql picture](images/mysql_q80.png)

1.

one-to-many

2.

parent-child

3.

many-to-many

4.

many-to-one

Q 82 / 96

Mysql

A stored routine is a set of SQL statements stored on the server and takes form as either a procedure or a function. Which statement cannot be used inside stored routines?

Explanation: Both `SET` and `DECLARE` are used to create variables. Reference: [MySQL STORED PROCEDURE Tutorial With Examples](https://www.softwaretestinghelp.com/mysql-stored-procedure/)

1.

`SELECT`

2.

`USE`

3.

`SET`

4.

`DECLARE`

Q 83 / 96

Mysql

When a new student is added to a new database, you want new records to be created in the related tables such as Exam, Score and Attendance. How would you accomplish this?

1.

trigger

2.

regular expression

3.

view

4.

index

Q 84 / 96

Mysql

In the diagram below, the ID fields are declared as type CHAR instead of INT . Which is NOT one of the possible reasons behind that decision?

![mysql picture](images/mysql_q85.png)

1.

The ID field needs to include letters and not just numbers.

2.

You can have a consistent format across all of the tables that require ID fields.

3.

The ID field needs to have leading 0s, which the INT data type would truncate.

4.

The `CHAR(10)` data type is more efficient and space-saving.

Q 85 / 96

Mysql

Why would you use a common table expression (CTE)?

Explanation: CTEs do not create temporary tables, they only work within a signle query. Reference: [13.2.15 WITH (Common Table Expressions)](https://dev.mysql.com/doc/refman/8.0/en/with.html).

1.

To define queries for later reuse for the duration of the current session

2.

To create temporary tables that can be used to pre-select often-used result sets.

3.

To calculate a new single value from a result set and return it to the query parser.

4.

To break down complex queries and allow reuse within a query.

Q 86 / 96

Mysql

Which option modifier tells a program not to exit with an error if it does not recognize the option, but instead to issue a warning?

Reference: [4.2.2.4 Program Option Modifiers](https://dev.mysql.com/doc/refman/8.0/en/option-modifiers.html)

1.

--verbose

2.

--skip

3.

--skip-error

4.

--loose

Q 87 / 96

Mysql

What does this SQL statement return?

SELECT name FROM students WHERE name REGEXP '^to';

1.

all names starting with "to," such as Tommy or Tony

2.

all names with "to," such as Roberto and Tommy

3.

all names without "to," such as Samantha or Kathryn

4.

all names ending with "to," such as Roberto

Q 88 / 96

Mysql

You are working with the tables as shown in the diagram. You need to generate the list of price totals for each make and model of car, with subtotals for each make, and the grand total of all prices. Which SQL clause do you use?

![mysql picture](images/mysql_q92.png)

1.

UNION

2.

SHOW TOTALS

3.

UNION ALL

4.

WITH ROLLUP

Q 89 / 96

Mysql

The left and right joins are also known as _.

1.

Inner Join

2.

Natural Join

3.

Outer Join

4.

Cartesian Join

Q 90 / 96

Mysql

What is the valid way to create a database view in MySQL?

1.

`CREATE VIEW v1 SELECT * FROM t1 WHERE col1 > 10;`

2.

`CREATE VIEW v1 AS BEGIN SELECT * FROM t1 END;`

3.

`CREATE VIEW v1 BEGIN SELECT * FROM t1 END;`

4.

`CREATE VIEW v1 AS SELECT * FROM t1;`

Q 91 / 96

Mysql

How are permissions implemented in MySQL?

1.

encrypted algorithms

2.

access control lists

3.

user settings

4.

administrator schema

Q 92 / 96

Mysql

Inside a transaction, several operations need to be performed. What would you do if an exception happens during that transaction?

1.

`UNDO`

2.

`UNCOMMIT`

3.

`ROLLBACK`

4.

`REVERSE

Q 93 / 96

Mysql

What function finds the current time or date in MySQL?

1.

DATE()

2.

GETDATE()

3.

CURDATE()

4.

CURRENT()

Q 94 / 96

Mysql

What is the correct usage of ENUM in MySQL?

1.

`Create table size (ENUM ('Small','Medium','Large'));`

2.

`Create table ENUM (name ('Small','Medium','Large'));`

3.

`Create table size (name: ENUM['Small','Medium','Large']);`

4.

`Create table size (name ENUM('Small','Medium','Large'));`

Q 95 / 96

Mysql

You are working with the tables as shown in this diagram. You need to make sure that any record added to the purchases table consists of a customerID, which already exists in the customers table, and a carID, which already exists in the cars table. You decide to use a trigger to do the validation. Which one do you use?

![mysql picture](images/mysql_q92.png)

1.

`IF EXISTS`

2.

`AFTER INSERT`

3.

`BEFORE INSERT`

4.

`CROSS JOIN`

Q 96 / 96