teste-5-8

22  Download (0)

Full text

(1)

TEST 5 TEST 5

1.

1. Given Given an an SQL SQL table table namednamed t t  having a column of type INT named having a column of type INT named c c  and the contents and the contents below, what will the f

below, what will the following query produce?ollowing query produce?

SELECT COUNT(c) FROM t GROUP BY c; SELECT COUNT(c) FROM t GROUP BY c; a.

a. four four records, records, having having the the values values of of NULL,8,2 NULL,8,2 and and 66 b.

b. one one record record having having a a value value of of 66 c.

c. three three records, records, having having the the values values of of 8, 8, 2 2 and and 66 d.

d. three three records, records, having having the the values values of of 2, 2, 1 1 and and 11 e.

e. four four records, records, having having the the values values of of 0,1,1 0,1,1 and and 22 f.

f. one one record record having having a a value value of of 44 E

E 2.

2. Given a populateGiven a populated SQL table havd SQL table having the definition below, wing the definition below, what will the SELECT queryhat will the SELECT query produce?

produce?

CREATE TABLE Shopping(ProductName VARCHAR(100), CREATE TABLE Shopping(ProductName VARCHAR(100),

Category VARCHAR(100), Category VARCHAR(100), Date DATETIME);

Date DATETIME);

SELECT Category, Date, COUNT(DISTINCT ProductName) AS nr FROM Shopping SELECT Category, Date, COUNT(DISTINCT ProductName) AS nr FROM Shopping

WHERE WHERE

Date>(CURRENT_DATE-INTERVAL 7 DAY) GROUP BY Date, Category HAVING nr>1; INTERVAL 7 DAY) GROUP BY Date, Category HAVING nr>1;

a.

a. the the number number of of different different products products bought bought from from each each category category every every day day in in the the lastlast 7 days, only if more than one product from that category has been bought that day 7 days, only if more than one product from that category has been bought that day b.

b. the the number number of of different different products products bought bought from from each each category category more more than than 7 7 daysdays ago, if that category includes at least 2 products

ago, if that category includes at least 2 products c.

c. the the number number of of products products bought bought from from each each category category starting starting 7 7 days days agoago d.

d. the the number number of of different different products products bought bought each each day day for for dates dates older older than than a a weekweek ago, only if more than one product from each category has been bought that day ago, only if more than one product from each category has been bought that day  A

(2)

3.

3. Which of the following are true regarding NULL values in MySQL expressions?Which of the following are true regarding NULL values in MySQL expressions? (choose three)

(choose three) a.

a. the the = = operator operator can can be be used used for for testing testing if if one one of of its its operands operands is is NULLNULL b.

b. the the <=> <=> operator operator will will return return 1 1 if if any any of of its its operands operands is is NULLNULL c.

c. most most operators operators return return 0 0 when when one one of of the the operands operands is is NULLNULL d.

d. when when testing testing if if an an expression expression evaluates evaluates as as NULL, NULL, the the IS IS NULL NULL or or IS IS NOT NOT NULLNULL operators may be used

operators may be used e.

e. most most operators operators return return NULL NULL when when one one of of the the operands operands is is NULLNULL f.

f. the the <=> <=> operator operator will will return return 1 1 if if both both operands operands are are NULLNULL DEF

DEF 4.

4. What What possible values possible values may may the the following MySQL following MySQL expression produce?expression produce?  ABS(FLOOR(RAND()*INTERV

 ABS(FLOOR(RAND()*INTERVAL(34.2, 17, 21, 56, 69))-ROUND(0.0156,2)*1AL(34.2, 17, 21, 56, 69))-ROUND(0.0156,2)*100)- 00)-CEIL(PI())/2 CEIL(PI())/2 a. a. 0, 0, 1 1 or or 22 b. b. 1 1 or or 22 c. c. 0 0 or or 11 d. d. 0, 0, 1 1 or or -1-1 e. e. 0 0 or or -1-1 E E 5.

5. What will What will be the valube the value of the e of the MySQL expMySQL expressionressions1 = s2 s1 = s2  if column if columns1s1 has the value has the value 'Test' and column

'Test' and column s2 s2  has the value 'TEST'? has the value 'TEST'?

a. 1

a. 1

b. NULL b. NULL c.

c. the the = = operator operator can't can't take take column column name name as as operandsoperands d.

d. depends depends on on the the charset charset and and collation collation of of the the columnscolumns

e. 0

e. 0

D D

(3)

6. Which of the following are valid ways of representing an integer value of 161 inside a MySQL expression? (choose four)

a. `161` b. 161 c. 0xA1 d. x'A1' e. xA1 f. X'A1' BCDF

7. Which of the following MySQL expressions will evaluate as yesterday's date? a. TODAY – INTERVAL 24 HOUR

b. CURRENT_DATE – INTERVAL 1 DAY c. CURRENT_DATE - INTERVAL 24 HOURS d. CURRENT_DATE - 24 HOUR

e. NOW - 1 DAYS

f. CURRENT_DATE – 1 DAY INTERVAL B

8. What value will be inserted on the Year column when executing the statements below on a MySQL server?

CREATE TABLE Dates(Year YEAR(4) NOT NULL); INSERT INTO Dates VALUES(2);

a. 2002

b. 2

c. 1902

d. 0000, because the inserted value is not valid  A

(4)

9. Given an SQL table named People, having 10 records, and the two SELECT statements below that operate on a column named Weight from that table, which of the following is NOT true?

SELECT FLOOR(Weight) FROM People; SELECT AVG(Weight) FROM People; a. the first query will return a result set containing 10 records b. the second query uses an aggregate function

c. the FLOOR() function will be called 10 times – once for each record d. the AVG() function will be called 10 times – once for each record e. the second query will return a result set containing 1 record

D

10. Which of the following are MySQL aggregate functions? (choose two) a. INSTR() b. MIN() c. LPAD() d. CONCAT_WS() e. AVG() f. LEAST() BE

11. After the table having the definition below has been populated with data, which of the following SELECT statements will NOT produce the same result as the others? CREATE TABLE Numbers (nr ENUM ('zero','one','two','three'));

a. SELECT * FROM Numbers WHERE nr>1 AND nr<4;

b. SELECT * FROM Numbers WHERE nr = 'one' AND nr='two'; c. SELECT * FROM Numbers WHERE nr = 'one' OR nr='two'; d. SELECT * FROM Numbers WHERE nr IN (2,3);

e. SELECT * FROM Numbers WHERE nr IN ('one','two');

f. SELECT * FROM Numbers WHERE nr = 'one' XOR nr='two'; B

(5)

12. What values will be inserted in the Numbers table when executing the statements below?

CREATE TABLE Numbers (c1 INT, c2 FLOAT, c3 INT); INSERT INTO Numbers VALUES(8%5, 8/5, 8 DIV 5);

a. 3, 1.6, 3 b. 3, 1.6, 1 c. 1.6, 1.6, 3 d. 8, 1.6, 1.6 e. 1.6, 1.6, 1.6 B

13. Given an SQL table column named TimeInterval, containing values of the form HH:MM:SS (where H=hour, M=minute, S=second), which of the following expressions can be used for extracting the number of minutes from the values of that column? (choose four) a. MINUTE(TimeInterval) b. SUBSTR(TimeInterval, 4, 2) c. SUBSTR(TimeInterval,2,4) d. LEFT(RIGHT(TimeInterval,5),2) e. SUBSTR(TimeInterval,LOCATE(':',TimeInterval)+1,2) f. SUBSTR(TimeInterval, 3, 5)  ABDE

14. Given a table named Dates that contains the columns Day, Month, Year and Fulldate, how could the Fulldate column be populated based on the values found in the other three? (choose two)

a. UPDATE Dates SET Fulldate=CONCAT_WS('-',Year,Month,Day); b. UPDATE Dates SET Fulldate=Year+'-'+Month+'-'+Day;

c. UPDATE Dates SET Fulldate=CONCAT('Year','-','Month','-','Day'); d. UPDATE Dates SET Fulldate=CONCAT(Year,'-',Month,'-',Day);

e. UPDATE Dates SET Fulldate=LPAD(CONCAT_WS('-',Month,Day),Year);  AD

(6)

15. Which of the following SQL statements will return all the records from the People table whose names are missing? (choose two)

a. SELECT * FROM People WHERE Name==NULL b. SELECT * FROM People WHERE Name=NULL c. SELECT * FROM People WHERE Name<=>NULL d. SELECT * FROM People WHERE Name LIKE 'NULL' e. SELECT * FROM People WHERE Name IS NULL CE

TEST 6

1. What is the difference between an inner join and an outer join between two tables? a. an inner join always retrieves all the records from one of the tables involved, while

an outer join only keeps records from one table that have corresponding records in the other table

b. an inner join may only be performed on a single table, while an outer join may be performed on multiple tables

c. an inner join only shows corresponding records from the tables involved, while an outer join always returns all the records from one of the tables even if there are no corresponding records in the other one

d. an inner join may only be performed inside the same database, while an outer  join may involve multiple tables from different databases or even different servers C

2. Which of the following are true about the SQL query below? (choose two) SELECT * FROM Categories LEFT JOIN Products ON(Products.ID=Categories.ProductID)

a. the result will always contain all the records from the Products table

b. if a category has no matching products, it will not be included in the query result c. the result will always contain all the records from the Categories table

d. if a category has no matching products, it will still be displayed in the result, but the columns corresponding to the Products table will contain the NULL value

e. the query will only select records that have NULL on the ProductID column CD

(7)

3. Which of the following statements will correctly create a table named Users having a unique index on the Username column? (choose two)

a. CREATE TABLE Users(Name VARCHAR(100), Username VARCHAR(50) UNIQUE);

b. CREATE TABLE Users(Name VARCHAR(100), Username VARCHAR(50), UNIQUE(Username));

c. CREATE TABLE Users(Name VARCHAR(100), Username VARCHAR(50) ADD INDEX UNIQUE(Username));

d. CREATE TABLE Users(Name VARCHAR(100), Username VARCHAR(50), INDEX(Username));

e. CREATE TABLE Users(Name VARCHAR(100), Username VARCHAR(50) CREATE INDEX UNIQUE(Username));

 AB

4. Which of the following types of indexes could be defined on a table column if we need the values of the column to be unique but want to allow NULL values?

a. non-unique index b. unique index

c. there is no type of index that can enforce that set of restrictions d. primary key

B

5. Which of the following are advantages of using indexes in SQL tables? (choose two) a. indexes can enforce restrictions on column data

b. increased speed of SELECT statements that have WHERE clauses using indexed columns

c. increased speed of UPDATE statements that do not have WHERE clauses d. increased speed of INSERT statements

e. increased speed of DELETE statements that do not have WHERE clauses  AB

(8)

6. Which of the following statements will join the Products and Categories tables and return all products from the 'books' category, if the c_id column from the Products table is referring the c_id column from the Categories table? (choose two)

a. SELECT Products.* FROM Products INNER JOIN Categories On(Products.c_id=Categories.c_id)

b. SELECT Products.* FROM Products INNER JOIN Categories ON (c_id)

c. SELECT Products.* FROM Products,Categories WHERE Products.c_id = Categories.c_id AND Categories.Name='books'

d. SELECTProducts.*FROMProducts,CategoriesWHERECategories.Name='books' e. SELECT Products.* FROM Products INNER JOIN Categories ON(Products.c_id

= Categories.c_id) WHERE Categories.Name='books' CE

7. Which of the following types of indexes can be defined in MySQL? (choose three) a. simple (non-unique) index

b. foreign key c. unique index d. primary key e. external index  ACD

8. Which answer correctly pairs each case described with the correct type of relationship?

1. Students and Classes: each student may be part of multiple classes, and each class may  contain multiple students

2. Products and Categories: each product may be part of one category, and each category may contain multiple products

3. Users and Usernames: each username corresponds to exactly one user

a. 1:1 b. 1:N c. M:N a. 1-a,2-c,3-b b. 1-b,2-c,3-a c. 1-b,2-a,3-c d. 1-c,2-b,3-a e. 1-a,2-b,3-c D

(9)

9. What will be the result of the SELECT query applied to the tables below?

SELECT * FROM Books LEFT JOIN Chapters ON (book_id=id)

a.

b.

c.

d.  A

10. Which of the following statements may be used for defining the columnid  as the primary key of the Books table after the table has been created and filled with data?

a. ALTER TABLE Books SET PRIMARY KEY = id; b. ALTER TABLE Books CREATE PRIMARY KEY; c. CREATE INDEX ON Books PRIMARY KEY(id); d. CREATE PRIMARY INDEX i ON Books(id); e. ALTER TABLE Books ADD PRIMARY KEY(id); E

(10)

11. Which of the following are true about the following SQL query, if the Products table has 3 columns and 6 records and the Categories table has 2 columns and 3 records? (choose three)

SELECT * FROM Products,Categories; a. the result of the query will have 5 columns

b. the query is a join between the two SQL tables c. the result of the query will have 18 records d. the result of the query will have 6 columns e. the result of the query will have 9 records  ABC

12. What is the difference between a unique index and a primary key? a. a primary key allows for duplicate values while a unique index doesn't b. a unique index allows for NULL values but a primary key does not

c. a unique index may be specified as part of the table's definition, while a primary key may not

d. there may be multiple primary key indexes defined in one table, but only one unique index is allowed

B

13. Given two related SQL tables namedPets and PetOwners having the definitions below:

CREATE TABLE Pets (id INT AUTO_INCREMENT PRIMARY KEY, Name VARCHAR(50)); CREATE TABLE PetOwners (id INT AUTO_INCREMENT PRIMARY KEY, OwnerName VA RCHAR(50), PetID INT);

what will the following query return after the tables have been populated with data? SELECT * FROM Pets WHERE Pets.id = (SELECT * FROM PetOwners WHERE OwnerNa me='John');

a. an error, because the subquery must always have an alias b. all pet owners having a pet named John

c. an error,because the= operator can never have a subquery as one of its operands d. all pets owned by John

e. an error, because the subquery produces more than 1 column and possibly more than one row

(11)

14. Which of the following are true about M-to-N relationships between two SQL tables? (choose three)

a. a record from the first table may have more than one corresponding record in the second table

b. M must be greater than N in order for the relationship to work

c. a record from the second table may have more than one corresponding record in the first table

d. such a relationship is usually implemented in the database by creating a third table having two foreign keys

e. an M-to-N relationship can't be defined on only two SQL tables –  at least four tables are required

 ACD

15. An SQL table column that contains values of the primary key from another table is called: a. primary key b. exported key c. index key d. unique key e. foreign key E

16. Which of the following queries return all the people that have 5 or 7 children from the table having the definition below? (choose three)

CREATE TABLE People(id INT PRIMARY KEY, Name VARCHAR(100), NumberOfChildre n INT);

a. SELECT * FROM People WHERE id IN (SELECT * FROM People WHERE NumberOfChildren IN (5,7))

b. SELECT * FROM People WHERE NumberOfChildren IN (5,7)

c. SELECT * FROM People WHERE id = ANY (SELECT id FROM People WHERE NumberOfChildren IN (5,7))

d. SELECT * FROM People WHERE id IN (SELECT id FROM People WHERE NumberOfChildren IN (5,7))

e. SELECT * FROM People WHERE id = ALL (SELECT * FROM People WHERE NumberOfChildren IN (5,7))

f. SELECT * FROM People WHERE id = (SELECT * FROM People WHERE NumberOfChildren IN (5,7))

(12)

TEST 7

1. Which of the following is NOT a valid way of starting a MySQL transaction? a. SET autocommit=0

b. START TRANSACTION c. SET autocommit=1

d. BEGIN

C

2. Which of the following types of SQL statements can be undone when cancelling an ongoing transaction?

a. DCL

b. DDL

c. DML

d. none of the above e. all of the above C

3. Will the table having the definition below be able to support transactions? CREATE TABLE t (i INT) ENGINE Innodb

a. no, because the specified storage engine does not support it

b. yes, because MySQL supports transactions and therefore all its tables do c. no, because the table's autocommit mode is not set to 1

d. yes, because the specified storage engine supports it D

(13)

4. After executing the set of SQL statements below, which of the following SQL statements will fail?

CREATE TABLE Localities(Name VARCHAR(200),Population INT);

INSERT INTO Localities VALUES('Bucharest',2000000),('Timisoara',312000);

CREATE ALGORITHM=MERGE VIEW bigcities AS SELECT * FROM Localities WHERE p opulation>50000 WITH CHECK OPTION;

a. INSERT INTO bigcities VALUES('Bucharest',2000000); b. DELETE FROM bigcities WHERE Name='Timisoara' c. UPDATE bigcities SET Population=Population+1; d. INSERT INTO bigcities VALUES('Voluntari',30000);

e. UPDATE bigcities SET Name='Bucuresti' WHERE Name='Bucharest' D

5. Given the variable definition below, which of the following correctly creates a prepared statement named st ? (choose two)

SET @q = 'SELECT * FROM Products WHERE productID=?'

a. PREPARE st SELECT * FROM Products WHERE productID=? b. PREPARE st FROM '@q'

c. PREPARE st FROM 'SELECT * FROM Products WHERE productID=?' d. PREPARE st FROM SELECT * FROM Products WHERE productID=? e. PREPARE st FROM @q

f. PREPARE st AS SELECT * FROM Products WHERE productID=? CE

6. Given the MySQL variable defined using the statement below, which of the following SQL statements shows an incorrect use of this variable? @a = 5;

a. SELECT * FROM Products LIMIT @a

b. SELECT * FROM Products WHERE Price>@a c. SET @b = @a+1

d. INSERT INTO Products(Price) VALUES(@a) e. SELECT SQRT(@a)

(14)

7. If a MySQL client has an ongoing transaction with a MySQL server, which actions of the client will make the changes made so far permanent? (choose four)

a. the client starts a new transaction b. the client sets autocommit to 1 c. the client disconnects

d. the client executes COMMIT e. the client executes ROLLBACK f. the client executes a DDL statement  ABDF

8. Which of the following SQL statements allows the client to obtain the list of views defined in the current database?

a. SHOW TABLES b. SHOW VIEWS

c. SHOW FULL TABLES d. DESCRIBE VIEWS

e. SHOW CREATE VIEWS C

9. Which of the following operators can be used for assigning a value to a MySQL user-defined variable? (choose two)

a. : b. =: c. = d. == e. := CE

(15)

10. Which of the following SQL statements correctly defines an SQL view?

a. CREATE VIEW Laptops FROM 'SELECT * FROM Computers WHERE computer_type=laptop'

b. CREATE VIEW Laptops AS 'SELECT * FROM Computers WHERE computer_type=laptop'

c. CREATE VIEW Laptops(*) AS SELECT * FROM Computers WHERE computer_type='laptop'

d. CREATE VIEW Laptops SELECT * FROM Computers WHERE computer_type=laptop

e. CREATE VIEW Laptops AS SELECT * FROM Computers WHERE computer_type='laptop'

E

11. What will be the values of variables @a and @b after the following set of SQL statements executes?

SET @a=5; SET @b=@a+1; SELECT @a=6,@a:=@a+@b,@b=8; a. 12 and 8

b. 11 and 6 c. 11 and 8 d. 12 and 6 B

12. Which of the following is true about MySQL transactions?

a. rolling back a transaction will undo all changes made by all the server's clients since starting the transaction

b. committing a transaction will undo all changes made by the client who started it since the beginning of the transaction

c. if a client starts a transaction, any other client will be able to roll it back

d. rolling back a transaction will undo all changes made by the client who initiated it since the start of the client's MySQL session

e. a transaction is a set of SQL statements that execute atomically (either all of them succeed or they do not modify data)

(16)

13. SQL views can be used for: (choose three)

a. storing useful predefined queries in the database, that act as virtual tables

b. gradually changing the structure of a database while maintaining compatibility with current client applications

c. atomically executing sets of SQL statements, with the possibility of rolling them back in case of error

d. defining precompiled queries that can be later executed using various sets of input parameters

e. restricting the columns and/or rows of an SQL table that a client can access  ABE

14. Which of the following is a precompiled query defined by the client that can be later executed repeatedly with various input parameters?

a. transaction

b. prepared statement c. user variable

d. view B

15. Which of the following types of query can be used for defining an SQL view?

a. UPDATE

b. SELECT c. DELETE d. INSERT B

16. Which of the following are true regarding MySQL client-defined (session) variables? (choose two)

a. variable names are case insensitive starting with MySQL 5.0 b. variable names must not contain digits

c. variable names must be preceded by @ d. variable names must be preceded by $

e. all variable names must be enclosed in double quotes  AC

(17)

17. When creating an SQL view, which of the following will prevent the view from being updatable? (choose four)

a. using aggregation functions in the SELECT statement that defines the view

b. creating a one-to-one relationship between the rows in the view and the rows in the base table

c. defining a view that only contains derived columns (calculated using expressions) d. using the MERGE algorithm

e. using DISTINCT in the SELECT statement that defines the view f. using the TEMPTABLE algorithm

 ACEF

18. Which of the following statements will show the list of columns that a view produces? (choose three)

a. SHOW FULL TABLES LIKE 'viewname' b. DESCRIBE viewname

c. SHOW VIEW viewname

d. SHOW CREATE VIEW viewname e. SHOW CREATE TABLE viewname BDE

TEST 8

1. When executing the set of statements below using themysql  client, what will the CALL statement produce?

DELIMITER $ SET @a=2;

CREATE PROCEDURE p(IN id INT) BEGIN

SELECT Name FROM Products WHERE productID=id INTO @b; END$

CALL p(@a);

a. an error, because procedures are not executed using CALL

b. a result set, because the procedure is using a SELECT statement c. NULL, because the procedure doesn't have a RETURN statement d. an error, because procedures are not allowed to produce result sets e. nothing, because it is using the wrong delimiter and it won't be executed E

(18)

2. What will be the value of@b after executing the statements below? SET @a=10;

DELIMITER $

CREATE PROCEDURE p(IN x INT) BEGIN SET x=4; SET @b = @a; END$ CALL p(@a)$ a. 10 b. 0 c. 4 d. NULL  A

3. What is true about the following stored procedure definition? CREATE PROCEDURE proc() SELECT * FROM Products;

a. the definition is invalid because the procedure has no RETURNS clause

b. the definition is invalid because the procedure is not declared as DETERMINISTIC or NOT DETERMINISTIC

c. the definition is invalid because a procedure may not produce a result set d. the definition is invalid because the procedure has no input parameters e. the definition is correct

f. the definition is invalid because it is missing the algorithm E

4. What is wrong with the following stored function definition? (choose two) CREATE FUNCTION test()

DECLARE var INT;

SELECT Name FROM Products LIMIT 1 INTO var; a. it is missing the set of input parameters

b. it is missing the BEGIN...END statement block delimiters

c. it is missing the RETURNS clause and the RETURN statement d. variables can only be assigned with SET, not with SELECT...INTO e. it is missing the default value for thevar  variable

(19)

5. In MySQL stored routines, a condition is:

a. a set of SQL statements run periodically by the database server b. a certain type of error that can appear inside the routine

c. a set of SQL statements that is run when an error appears inside a stored routine d. a set of SQL statements that is run when a table's data is modified

B

6. Which of the following types of SQL code stored on the server is attached to a table and run automatically when table data is modified?

a. trigger

b. stored function c. stored procedure d. event

 A

7. Which of the following are true about a MySQL stored function? (choose three) a. it can produce more than one output value

b. it can be executed by simply using its name and a possible list of parameter values

c. it can be executed using the CALL statement d. it returns exactly one value

e. it can produce a result set

f. it can only have parameters of type IN BDF

8. Which of the following SQL statements can be used for forcefully exiting a labeled BEGIN...END block inside a stored procedure?

a. LEAVE

b. REPEAT

c. LOOP

d. RETURNS

(20)

9. Which of the following is a valid use of a MySQL flow control construct? a. LOOP SET @var=@var+1; END LOOP;

b. LOOP @var<10 DO @var=@var+2; END;

c. REPEAT DO SET @var=@var+1 UNTIL @var=5 END REPEAT; d. WHILE @var>4 SET @var:=@var+1; DONE;

e. WHILE @var>4 THEN SET @var:=@var+1; END WHILE  A

10. A MySQL trigger can be automatically executed for which of the following types of SQL statements? (choose three)

a. TRUNCATE b. DROP c. SELECT d. UPDATE e. DELETE f. INSERT DEF

11. Which of the following are true about a MySQL stored procedure? (choose three) a. it can produce more than one output value

b. it can be executed using the EXECUTE statement c. it returns exactly one value

d. it can be executed using the CALL statement e. it can only have parameters of type IN

f. it can produce a result set  ADF

(21)

12. All of the following are true about MySQL local variables, EXCEPT:

a. local variables declared inside a stored routine will remain available after the execution of the stored routine ends

b. local variables can be declared using the DECLARE statement c. local variables must be declared before use

d. local variable names are not preceded with @

e. all local variables must be declared at the beginning of the stored routine, before declaring any cursors, conditions or handlers

f. multiple local variables may be declared using a single DECLARE statement, but they will all have the same type and default value

 A

13. A MySQL cursor is used for:

a. accessing the rows of a result set from inside a stored routine

b. automatically executing SQL code when table data is being modified c. periodically executing a set of SQL statements in the database

d. reacting to certain types of errors that appear inside a stored routine  A

14. What is the value of @var  after executing the following set of SQL statements? SET @var = 0;

CASE @var+10

WHEN 0 THEN SET @var=10; WHEN 10 THEN SET @var = 20; WHEN 20 THEN SET @var = 30; ELSE SET @var = 40;

END CASE; a. 40 b. 10 c. 20 d. 30 C

(22)

15. A MySQL condition can be identified by its: (choose two) a. attached cursor

b. MySQL error code c. attached handler name d. SQLSTATE code

BD

16. Choose the answer that corresponds to the correct order of DECLARE statements inside a MySQL stored routine:

a. handlers b. variables c. cursors d. conditions a. a,b,c,d b. b,d,c,a c. c,d,b,a d. d,b,c,a B

17.What types of parameters may a MySQL stored procedure have? (choose three)

a. INOUT b. RETURN c. OUT d. RETURNS e. IN  ACE

18.Which of the following MySQL flow-control constructs are used for repeatedly executing a set of SQL statements? (choose three)

a. CASE b. LOOP c. IF d. REPEAT e. WHILE BDE

Figure

Updating...

References

Related subjects :