MySQL Test

MySQL Test

 

Note:  Upwork MySQL Test questions are posted and answers will be updated soon.


Which of the following CREATE statements can be used in MySQL?

Note: There may be more than one right answer.

a. CREATE DATABASE
b. CREATE VIEW
c. CREATE CLIENT
d. CREATE SERVER


With SQL, how do you select all the records from a table named “Customers” where the “LastName” is alphabetically between (and including) “Martinez” and “Smith”?

a. SELECT * FROM Customers WHERE LastName BETWEEN ‘Martinez’ AND ‘Smith’
b. SELECT LastName>’Martinez’ AND LastName<’Smith’ FROM Customers
c. SELECT * FROM Customers WHERE LastName>’Martinez’ AND LastName<’Smith’
d. SELECT Customers WHERE LastName BETWEEN ‘Martinez’ AND ‘Smith’


What is the correct syntax to switch to a new database in MySQL?

a. switch database_name;
b. connect database_name;
c. use database_name;
d. start database_name;


Select valid spatial functions:

Note: There may be more than one right answer.

a. Point
b. MBRMultiPoint
c. ST_Distance
d. ST_LineString
e. Polygon


Which of the following are valid encryption functions?

Note: There may be more than one right answer.

a. MD5
b. AES_ENCRYPT
c. SHA512
d. SHA2


What is the output when the following query executes?

CREATE TABLE t2 (val INT)

PARTITION BY LIST(val)(
PARTITION mypart VALUES IN (1,3,5),
PARTITION MyPart VALUES IN (2,4,6)

);

a. A table ‘t2’ is created with List Partitioning
b. Failure/Error occurs
c. No partitions are created


What is the correct syntax to grant all privileges on all databases to a user?

a. GRANT ALL_PRIVILEGES ON * . * TO ‘newuser’@’localhost’;
b. GRANT ALL PRIVILEGES ON * TO ‘newuser’@’localhost’;
c. GRANT ALL PRIVILEGES ON * . * TO ‘newuser’@’localhost’;
d. GRANT ALL_PRIVILEGES ON * TO ‘newuser’@’localhost’;


MyISAM tables can have three different storage formats: static (fixed-length), dynamic or compressed. Which of the following statements are true for the static format?

Note: There may be more than one right answer.

a. It is very quick and easy to cache.
b. There are no limitations regarding column types.
c. It requires much less disk space than the other two storage formats.
d. It is easy to reconstruct after a crash, because rows are located in fixed positions.


Is there any function in MySQL that allows for replace through a regular expression?

SELECT();

SELECT REPLACE(‘stackowerflow’, ‘ower’, ‘over’);

a. Output: “stackoverflow”
b. USER DEFINED FUNCTIONS
c. SELECT regex_replace(‘[^a-zA-Z0-9]+‘, ”, “%$&?/’|test><+-,][)(” );
d. Both A and B
e. None of the Above


Prev1 of 3

Share This Post