1. Question: What is wrong with the following query:
    select * from Orders where OrderID = (select OrderID from OrderItems where ItemQty > 50)

    A
    In the sub query, '*' should be used instead of 'OrderID'

    B
    The sub query can return more than one row, so, '=' should be replaced with 'in'

    C
    The sub query should not be in parenthesis

    D
    None

    Note: Not available
    1. Report
  2. Question: Which of the following is a correct way to show the last queries executed on MySQL?

    A
    First execute SET GLOBAL log_output = 'TABLE'; Then execute SET GLOBAL general_log = 'ON'; The last queries executed are saved in the table mysql.general_log

    B
    Edit the MySQL config file (mysql.con) and add the following line log = /var/log/mysql/mysql.log

    C
    Execute VIEW .mysql_history

    D
    Restart MySQL using the following line tail -f /var/log/mysql/mysql.log

    Note: Not available
    1. Report
  3. Question: Choose the appropriate query for the Products table where data should be displayed primarily in ascending order of the ProductGroup column. Secondary sorting should be in descending order of the CurrentStock column.

    A
    Select * from Products order by CurrentStock,ProductGroup

    B
    Select * from Products order by CurrentStock DESC,ProductGroup

    C
    Select * from Products order by ProductGroup,CurrentStock

    D
    Select * from Products order by ProductGroup,CurrentStock DESC

    E
    None

    Note: Not available
    1. Report
  4. Question: What is the correct SQL syntax for returning all the columns from a table named "Persons" sorted REVERSE alphabetically by "FirstName"?

    A
    SELECT * FROM Persons WHERE FirstName ORDER BY FirstName DESC

    B
    SELECT * FROM Persons SORT REVERSE 'FirstName'

    C
    SELECT * FROM Persons ORDER BY -'FirstName'

    D
    SELECT * FROM Persons ORDER BY FirstName DESC

    Note: Not available
    1. Report
  5. Question: You want to display the titles of books that meet the following criteria: 1. Purchased before November 11, 2002 2. Price is less than $500 or greater than $900 You want to sort the result by the date of purchase, starting with the most recently bought book. Which of the following statements should you use?

    A
    SELECT book_title FROM books WHERE price between 500 and 900 AND purchase_date < '2002-11-11' ORDER BY purchase_date;

    B
    SELECT book_title FROM books WHERE price IN (500, 900) AND purchase_date< '2002-11-11' ORDER BY purchase date ASC;

    C
    SELECT book_title FROM books WHERE price < 500 OR>900 AND purchase_date DESC;

    D
    SELECT book_title FROM books WHERE (price < 500 OR price > 900) AND purchase_date < '2002-11-11' ORDER BY purchase_date DESC;

    Note: Not available
    1. Report
  6. Question: State whether true or false: Transactions and commit/rollback are supported by MySQL using the MyISAM engine

    A
    True

    B
    False

    Note: Not available
    1. Report
  7. Question: Consider the following table structure of students:
    rollno int
    name varchar(20)
    course varchar(20)
    What will be the query to display the courses in which the number of students enrolled is more than 5?

    A
    Select course from students where count(course) > 5;

    B
    Select course from students where count(*) > 5 group by course;

    C
    Select course from students group by course;

    D
    Select course from students group by course having count(*) > 5;

    E
    Select course from students group by course where count(*) > 5;

    F
    Select course from students where count(group(course)) > 5;

    G
    Select count(course) > 5 from students;

    H
    None

    Note: Not available
    1. Report
  8. Question: MySQL supports 5 different int types. Which one takes 3 bytes?

    A
    TINYINT

    B
    MEDIUMINT

    C
    SMALLINT

    D
    INT

    E
    BIGINT

    Note: Not available
    1. Report
  9. Question: Which of the following is the correct way to determine duplicate values?

    A
    SELECT column_duplicated, sum(*) amount FROM table_name WHERE amount > 1 GROUP BY column_duplicated

    B
    SELECT column_duplicated, COUNT(*) amount FROM table_name WHERE amount > 1 GROUP BY column_duplicated

    C
    SELECT column_duplicated, sum(*) amount FROM table_name GROUP BY column_duplicated HAVING amount > 1

    D
    SELECT column_duplicated, COUNT(*) amount FROM table_name GROUP BY column_duplicated HAVING amount > 1

    Note: Not available
    1. Report
  10. Question: Examine the query: select (2/2/4) from tab1; where tab1 is a table with one row. This would give a result of:

    A
    4

    B
    2

    C
    1

    D
    .5

    E
    .25

    F
    8

    G
    25

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd