SQL MCQS
SQL MCQS
a) Object-oriented
b) Hierarchical
c) Relational
d) Network
View Answer
a) Objects
b) Tables
c) Networks
d) File systems
View Answer
a) True
b) False
View Answer
a) Table
b) Row
c) Column
d) Object
View Answer
b) Row
c) Column
d) Object
View Answer
a) SQL
b) Network calls
d) APIs
View Answer
name CHAR(30),
roll_num INT,
address CHAR(30),
phone CHAR(12)
);
a) A table
b) A row
c) A column
d) An object
View Answer
8. Which is the MySQL instance responsible for data processing?
a) MySQL client
b) MySQL server
c) SQL
View Answer
a) mysqla
b) mysqlb
c) mysqlc
d) mysqld
View Answer
10. In MySQL databases, the structure representing the organizational views of the entire databases
is ____________
a) Schema
b) View
c) Instance
d) Table
1. Which of the following clauses is used to display information that match a given pattern?
a) LIKE
b) WHERE
c) IS
d) SAME
View Answer
2. What column names are displayed when this SQL command is executed?
View Answer
3. The special database that always exists after setting up MySQL in a computer is __________
a) sampdb
b) mysql
c) information_schema
d) readme_db
View Answer
name CHAR(30),
student_id INT,
) ENGINE = InnoDB;
a) database name
b) table name
c) reference engine
d) storage engine
View Answer
a) Student
b) Values
c) Kyle
d) M
View Answer
a) row name
b) column name
c) table name
d) database name
View Answer
a) /
b) \
c) DIV
d) //
View Answer
8. The NULL value also means ___________
b) unknown value
c) negative values
d) a large value
View Answer
a) zero
b) a positive value
c) a negative value
d) null
View Answer
a) GROUP
b) GROUP BY
c) ORDER
d) ORDER BY
View Answer
1. MySQL client runs on the machine containing the databases and servers connect to the client over
a network.
a) True
b) False
View Answer
emp_name CHAR(30),
emp_id INT
);
a) 30
b) 1
c) 2
d) 3
View Answer
3. Which of the following options tells mysql to ask for entering the password?
a) -e
b) -p
c) -u
d) -h
View Answer
a) cobra.snake
b) cobra.snake.net
c) sampadam
d) cobra
View Answer
a) user name
b) password
c) host name
d) table name
View Answer
a) table
b) time only
c) date only
View Answer
7. Suppose you want to select a database named ‘sampledb’ as the default database. Which of the
following commands do you use?
a) SELECT DATABASE()
d) USE sampledb
View Answer
8. What does ‘abc’ & ‘xyz’ specify in the following SQL statement?
View Answer
9. To see the table structure, which of the following SQL commands is issued?
a) DESCRIBE tbl_name
b) VIEW tbl_name
d) SELECT tbl_name
View Answer
10. SHOW DATABASES lists the databases in the server to which you are connected.
a) True
b) False
View Answer
1. The command to move the cursor to the beginning of line in MySQL input editor is?
a) Ctrl-A
b) Ctrl-E
c) Ctrl-D
d) Esc-a
View Answer
a) copies to clipboard
a) .mysql_queries
b) .queries
c) .mysql_history
d) .history
View Answer
a) True
b) False
View Answer
a) chmod +e run_me.sh
b) chmod +a run_me.sh
c) chmod +y run_me.sh
d) chmod +x run_me.sh
View Answer
6. To execute the contents of a query file ‘exec.sql’ by feeding it to mysql, which command is used?
c) mysql exec.sql
d) mysql exec
View Answer
7. Which option prints output in table-format when MySQL is run interactively?
a) -t
b) -tf
c) -p
d) -pf
View Answer
8. The clause that enables mapping a short command to a long command is __________
a) map
b) direct
c) label
d) alias
View Answer
9. The connection parameters for setting up MySQL can be stored in an option file to save typing the
names every time a connection is established.
a) True
b) False
View Answer
a) .my.cnf
b) .my.ini
c) .my.opt
d) .my.opc
View Answer
b) $
c) 2
d) .
View Answer
a) True
b) False
View Answer
a) single quotes
b) double quotes
c) backticks
d) can’t be quoted
View Answer
a) 123_id
b) 123id
c) id1
d) 123
View Answer
5. Which server mode value enables use of double quotes to wrap identifier names?
a) ANSI
b) ANSI_QUOTES
c) TRADITIONAL
d) PIPES_AS_CONCAT
View Answer
6. Which server mode value disables use of built in function names as identifiers?
a) ANSI
b) IGNORE_FUNC
c) TRADITIONAL
d) IGNORE_SPACE
View Answer
a) 64
b) 128
c) 256
d) 32
View Answer
View Answer
b) False
View Answer
10. Which of the following MySQL statements is valid if ‘`sampledb`’ is a database and ‘`tbl`’ is a
table in it?
1. Case sensitivity in SQL statements does not vary for different operating systems of the machine on
which the server is running.
a) True
b) False
View Answer
a) invalid
View Answer
3. The default case sensitivity of database and table names depends on ___________
a) SQL server
View Answer
c) Trigger name
d) Event name
View Answer
a) lower_case_table_names
b) lower_case_all
c) lower_case_alias
d) lower_case_aliases
View Answer
a) lower
b) upper
c) mixed
d) random
View Answer
7. Regardless of whether a database or table name is case sensitive on the system, it must be
referred to using the same lettercase throughout a given query.
a) True
b) False
View Answer
a) Event names
c) Column names
d) Indexes
View Answer
a) COLLATION
b) ATOMICITY
c) COLLABORATION
d) NORMALIZATION
View Answer
a) Accent Insensitive
b) Augment Insensitive
c) Articulate Insensitive
d) Addition Insensitive
View Answer
a) USE
b) CREATE
c) DROP
d) SCHEMA
View Answer
a) TABLE
b) OBJECT
c) DB
d) SCHEMA
View Answer
3. It is not required to have an access privilege for a database before selecting it with ‘USE’.
a) True
b) False
View Answer
a) CREATE
b) SET
c) SETUP
d) LINK
View Answer
5. The file created by the server to store the database attributes is __________
a) db.otp
b) dp.zip
c) db.opt
d) db.cls
View Answer
a) IF EXISTS
b) IF NOT EXISTS
c) CREATE EXISTS
d) EXISTS IF
View Answer
7. If COLLATE is given without CHARACTER SET, the first part of the collation name gives the
character set.
a) True
b) False
View Answer
8. MySQL stores the database character set and collation attributes in the file _________
a) dp.opt
b) db.opt
c) db.sv
d) db.zip
View Answer
b) SHOW DATABASE
c) SHOW CREATE
View Answer
10. Which statement makes changes to the database’s global attributes?
a) CHANGE
b) ALTER
c) ALTERNATE
d) UPDATE
a) DROP INDEX
b) DELETE INDEX
c) REMOVE INDEX
d) FLUSH INDEX
View Answer
a) InnoDB
b) ARCHIVE
c) Falcon
d) NDB
View Answer
a) EXAMPLE
b) ARCHIVE
c) MyISAM
d) NDB
View Answer
4. What is the name of the format file for a table named my_tbl?
a) my_tbl.fmt
b) my_tbl.frm
c) my_tbl.fmr
d) my_tbl.ftm
View Answer
5. In the CREATE TABLE statement, the engine name specified is case sensitive.
a) True
b) False
View Answer
a) TEMP
b) TEMPO
c) TEMPR
d) TEMPORARY
View Answer
7. Which storage engine enables to access tables from a MySQL server managed by another server?
a) InnoDB
b) EXAMPLE
c) MyISAM
d) FEDERATED
View Answer
b) False
View Answer
a) HASH
b) SPATIAL
c) FULLTEXT
d) UNIQUE
View Answer
a) CHANGE
b) CHANGENAME
c) CHANGENM
d) RENAME
a) select_list
b) table_list
c) row_constraint
d) grouping_columns
View Answer
2. In inner join, result is produced by matching rows in one table with rows in another table.
a) True
b) False
View Answer
3. The join where all possible row combinations are produced is called _________
a) INNER JOIN
b) OUTER
c) NATURAL
d) CARTESIAN
View Answer
a) WHERE
b) SORT
c) GROUP
d) GROUP BY
View Answer
a) INNER JOIN
b) NATURAL JOIN
c) OUTER JOIN
d) CARTESIAN JOIN
View Answer
a) True
b) False
View Answer
7. The left and right joins are also known as __________
a) INNER JOIN
b) NATURAL JOIN
c) OUTER JOIN
d) CARTESIAN JOIN
View Answer
a) COMPLETE
b) SELF
c) OBSOLETE
d) CROSS
View Answer
9. In which join all the rows from the left table appear in the output irrespective of the content of
the other table?
a) RIGHT JOIN
b) LEFT JOIN
c) INNER JOIN
d) OUTER JOIN
View Answer
10. The join in which all the rows from the right table appear in the output irrespective of the
content of the other table is ___________
a) CARTESIAN JOIN
b) CROSS JOIN
c) INNER JOIN
d) RIGHT JOIN
1. The facility that allows nesting one select statement into another is called __________
a) nesting
b) binding
c) subquerying
d) encapsulating
View Answer
a) scalar
b) column
c) row
d) table
View Answer
a) True
b) False
View Answer
4. Which operators are used when a subquery returns multiple rows to be evaluated in comparison
to the outer query?
a) IN and NOT IN
View Answer
b) column
c) table
d) database
View Answer
6. Which of these operators perform similar operations like ALL and ANY?
a) SOME
b) MANY
c) SELECT
d) GROUP
View Answer
a) IN and NOT IN
c) PRESENT
d) ABSENT
View Answer
8. An uncorrelated subquery does not contain any reference to the values from the outer query.
a) True
b) False
View Answer
a) Correlated
b) Uncorrelated
c) EXISTS
d) NOT EXISTS
View Answer
a) =
b) ==
c) <=
d) >=
1. To combine multiple retrievals, we write several SELECT statements and put the keyword between
them. What is the keyword?
a) COMBINE
b) CONCAT
c) JOIN
d) UNION
View Answer
a) row name
b) column name
c) table name
d) database name
View Answer
a) True
b) False
View Answer
4. Which keyword used with UNION does not retain duplicate rows?
a) ALL
b) NARROW
c) STRICT
d) DISTINCT
View Answer
a) ALL
b) NARROW
c) STRICT
d) DISTINCT
View Answer
a) True
b) False
View Answer
a) LIMIT
b) ORDER BY
c) GROUP BY
d) SORT
View Answer
8. Suppose it is desired that UNION operation should return not more than 3 rows. Which keyword is
used for this?
a) LIMIT
b) RESTRICT
c) COUNT
d) SORT
View Answer
a) TRADITIONAL
b) MERGE
c) SERVELET
d) UNITE
View Answer
a) UNION ALL
b) UNION
c) UNION DISTINCT
d) JOIN
b) column name
c) table name
d) database name
View Answer
a) column name
b) table name
c) row name
d) database name
View Answer
a) True
b) False
View Answer
a) column name
b) table name
c) row name
d) database name
View Answer
5. What is x in the following MySQL statement?
a) column name
b) table name
c) server name
d) database name
View Answer
6. Qualifying the name of column with the table name is not necessary in single-table updates.
a) True
b) False
View Answer
a) previous val1
b) updated val1
c) unchanged
d) val1 + 1
View Answer
View Answer
a) ASSIGN
b) SET
c) MARK
d) GET
View Answer
10. Which keyword is used to delete all the rows from the table?
a) TRUNCATE
b) REMOVE
c) DELETE ALL
d) CLEAR
1. Which among the following is the correct syntax for creating table?
b) CREATE name;
c) CREATE TABLE
View Answer
c) Restrictions on columns
a) DESC table_name;
b) DESC table_name
c) DESC
View Answer
4. Which among the following is the correct syntax for defining “Constraint Check” in Mysql?
View Answer
5. Which data type character merges the “Check Constraint” into a data type definition?
a) ENUM
b) ENUM1
c) ENUM2
View Answer
6. Which among the following is the correct syntax for defining “ENUM” in Mysql?
b) gender ENUM,
c) gender ENUM ( ),
d) none of the mentioned
View Answer
7. Which among the following are the correct definitions for “NULL” in Mysql?
a) Absence of value
b) Unknown
c) Empty set
View Answer
8. Find out the logical error in the following MySQL code snippet?
( person_id VARCHAR(20),
Mobile_no SMALLINT
);
b) Incorrect definition
View Answer
a) Primary key
b) NULL
c) Foreign Key
View Answer
a) NULL
b) 0
c) 1
d) -1
a) INSERT INTO
b) Insert
c) INSERT
View Answer
a) Yes
b) No
View Answer
a) Composite attributes
b) Multivalued attributes
c) Table name
View Answer
fname VARCHAR(20),
lname VARCHAR(20),
b) Super key
c) Composite key
d) Primary key
View Answer
5. Which statement can be used for modifying the definition for an existing table?
a) ALTER
b) Modified
c) SELECT
d) FROM
View Answer
6. Which feature is used for the automatic increment of the column?
a) AUTO_INCREMENT
b) AUTO
c) INCREMENT
View Answer
7. Which among the following is the correct syntax for modifying the definition of an existing table?
View Answer
(person_id, fname,lname)
VALUES (1,’S’,’U’),
VALUES (1,’T’,’U’);
a) Error
b) No Error
c) Depends
View Answer
9. Will the following SQL command produce any error?
(person_id, fname,lname)
VALUES (1,’S’,’U’),
VALUES (2,’T’,’U’);
a) Error
b) No Error
c) Depends
View Answer
a) NULL
b) 0
c) -1
d) Undefined
1. Which statement is used to select columns and rows from the table?
a) SELECT
b) ALTER
c) MODIFY
d) FROM
View Answer
FROM person;
a) Table name
b) Attribute
c) Multivalued attribute
View Answer
View Answer
4. Which Clause is used to select a particular row from the set of row in an existing table?
a) WHERE
b) FROM
c) ALTER
View Answer
View Answer
a) ORDER by CLAUSE
b) MODIFY
c) ALTER
d) UPDATE
View Answer
a) WHERE
b) SELECT
c) FROM
d) ALTER
View Answer
8. Which command is used to show all tables that are stored in a database?
a) SHOWS
b) SHOW
c) SHOWES
View Answer
9. Which among the following is the correct syntax for showing all tables in the database?
a) SHOWS TABLES
b) SHOW TABLE
c) SHOW
d) SHOWS TABLES;
View Answer
10. If attribute “fruit” stores data as “apple, mango, banana” in table person then what will be the
output of the following SQL command?
WHERE person_id=1
ORDER BY fruit;
a) UPDATE
b) WHERE
c) MODIFY
d) ALTER
View Answer
a) DELETE
b) WHERE
c) MODIFY
View Answer
UPDATE person
SET lname=’s’,
Fname = ’p’,
WHERE person_id = 1;
a) Single row
b) Double row
c) No row
View Answer
UPDATE person
SET lname=’s’,
Fname=’p’,
WHERE person_id<10;
a) 0-9
b) 1-6
c) No row
d) None of the mentioned
View Answer
DELETE person
WHERE person_id=1;
a) 1
b) 0
c) No row
View Answer
DELETE person
WHERE person_id<10;
a) 0-9
b) 1-7
c) No row
View Answer
a) NO
b) YES
c) May be
View Answer
a) RENAME
b) MODIFY
c) ALTER
View Answer
c) Drop a column
View Answer
2. Which declaration represents that “character data will consume the same number of bytes as
declared and is right padded”?
a) Char
b) Varchar
c) Both Char and Varchar
View Answer
3. Which declaration doesn’t use the same number of bytes and consumption of bytes depends on
the input data?
a) Varchar
b) Char
View Answer
a) 255 bytes
c) 256 bytes
View Answer
View Answer
a) Varchar
b) Varchar 3
c) Varchar2
View Answer
7. Mysql support different character sets, which command is used to display all character sets?
b) SHOW;
c) CHARACTER SET;
View Answer
8. Which one is the correct declaration for choosing the character set other than default?
b) Varchar(20);
View Answer
a) Tiny text
b) Text
c) Medium text
d) Long text
View Answer
b) Char
c) Text type
1. What will happen if the data being loaded into a text column exceeds the maximum size of that
type?
b) Process terminate
View Answer
2. Which data type is more suitable for storing “small notes” in Mysql?
a) Char
b) Varchar
c) Mediumtext
d) Longtext
View Answer
a) Varchar
b) Longtext
c) Mediumtext
View Answer
a) Whole numbers
b) Natural numbers
c) Rational numbers
View Answer
a) Mediumint
b) Smallint
c) Int
d) Tinyint
View Answer
a) Total of four digits, two to the left of decimal and two to the right of decimal
View Answer
a) 24.33
b) 124.4
c) 12.123
View Answer
b) 12345.1
c) 12345
d) 123.123
View Answer
a) Total of 1 digit
b) Total of 2 digit
c) Total of 2 digit, one digit at right of the decimal, one digit at left of the decimal
d) Char/Varchar
View Answer
a) YYYY-MM-DD
b) MM-YYYY-DD
c) DD-MM-YYYY
View Answer
a) YYYY-MM-DD HH:MI:SS
b) MM-YYYY-DD HH:MI:SS
c) DD-YYYY-MM MI:HH:SS
View Answer
a) YYYY-MM-DD HH:MI:SS
b) MM-YYYY-DD HH:MI:SS
c) DD-YYYY-MM MI:HH:SS
View Answer
a) YYYY
b) YYYY-DD-MM
c) MM-YYYY-DD
View Answer
a) HHH:MI:SS
b) SS:MI:HHH
c) MI:SS:HHH
View Answer
b) No
c) Depends
View Answer
a) 12.11
b) 13.1
c) 1.12
d) 123.44
a) FLOAT
b) DOUBLE
c) INT
d) BIGINT
View Answer
a) VARCHAR
b) BINARY
c) VARBINARY
d) BLOB
View Answer
a) VARCHAR
b) BINARY
c) VARBINARY
d) BLOB
View Answer
4. Which data and time datatype stores time value in ‘hh:mm:ss’ format?
a) DATE
b) TIME
c) DATETIME
d) TIMESTAMP
View Answer
a) GEOMETRY
b) POINT
c) LINESTRING
d) POLYGON
View Answer
6. How many of the following attributes are allowed only for numeric types?
a) 1
b) 2
c) 3
d) 4
View Answer
7. A DEFAULT value cannot be supplied to spatial types.
a) True
b) False
View Answer
a) True
b) False
View Answer
a) 16 bit
b) 32 bit
c) 48 bit
d) 64 bit
View Answer
a) 16 bit
b) 32 bit
c) 48 bit
d) 8 bit
8. The number of strings among the following matched with ‘%all%’ is _____________
a) 1
b) 2
c) 3
d) 4
10. Which of the following statements does not modify the table?
a) INSERT
b) UPDATE
c) DELETE
d) SELECT
a) DROP TABLE
b) DELETE
View Answer
a) SHOW TABLES
b) SHOW TABLE
c) SHOW
View Answer
a) Yes
b) No
c) Depends
a) Yes
b) No
c) Depends
View Answer
a) DEC-01-1991
b) 01-1991-11
c) 01-DEC-12
d) 1991-11-01
View Answer
a) Numerical
b) Temporal
c) Text
View Answer
VALUES(1,’s’,’p’);
a) No error
View Answer
(1,’s’,’p’, 24-1991-01);
b) No error
View Answer
9. Which Key is used to link two tables in Mysql?
a) Primary Key
b) Foreign Key
View Answer
View Answer
a) SELECT
b) FROM
c) WHERE
View Answer
a) UPDATE
b) ALTER
c) MODIFY
View Answer
1. Which clause is used to determine “which column to include in the query sets”?
a) SELECT
b) FROM
c) WHERE
d) ORDER BY
View Answer
2. Which clause is used to “Identifies table from which to draw table and how the table should be
joined”?
a) FROM
b) SELECT
c) ORDER By
d) WHERE
View Answer
a) FROM
b) WHERE
c) SELECT
d) ORDER BY
View Answer
a) SELECT
b) GROUP BY
c) FROM
d) WHERE
View Answer
5. Which clause is used to “filter out unwanted Groups”?
a) HAVING
b) FROM
c) WHERE
d) SELECT
View Answer
6. Which clause is used to “sort the rows of the final result set by one or more columns”?
a) HAVING
b) ORDER BY
c) WHERE
d) FROM
View Answer
a) ALTER
b) FROM
c) SELECT
d) MODIFY
View Answer
a) WHERE
b) MODIFY
c) ALTER
d) FROM
View Answer
9. “MODIFY” is used with which “Query clause”?
a) ALTER
b) FROM
c) WHERE
d) ORDER BY
View Answer
4. The string function that returns the index of the first occurrence of substring is _____________
a) INSERT()
b) INSTR()
c) INSTRING()
d) INFSTR()
a) select_list
b) table_list
c) row_constraint
d) grouping_columns
View Answer
Answer: a
Explanation: Given above was a basic syntax of the SELECT statement. Everything in the syntax is
optional except the ‘select_list’ option. All the others are free to be omitted, and will work fine.
9. The join in which all the rows from the right table appear in the output irrespective of the content
of the other table is ______________
a) CARTESIAN JOIN
b) CROSS JOIN
c) INNER JOIN
d) RIGHT JOIN
10. The facility that allows nesting one select statement into another is ______________
a) nesting
b) binding
c) subquerying
d) encapsulating
7. The clause that is used to display information that matches a given pattern is _____________
a) WHERE
b) IS
c) SAME
d) LIKE
View Answer
Answer: a
Explanation: None.
a) SELECT
b) WHERE
c) FROM
View Answer
3. What will be the output of the following SQL statement?
SELECT *
FROM person;
View Answer
FROM person;
a) Show only columns (person_id, Fname, lname) and rows related to these columns
View Answer
a) YES
b) NO
c) DEPENDS
View Answer
6. Find the error in the following SQL statement?
SELECT *;
a) No Error
b) No table mentioned
c) Depends
View Answer
WHERE person_id=1;
a) Show all columns but only those rows which belongs to person_id=1
View Answer
FROM person
WHERE person_id=1;
a) Show only columns(person_id, fname, lname) but only those rows which belongs to person_id=1
View Answer
a) FROM
b) WHERE
1. Which among the following can also be included with “SELECT” clause while writing query in
Mysql?
a) Literals
b) Expressions
View Answer
emp_id * 3.145,
UPPER (lname)
FROM Employee;
a) Yes
b) NO
c) Depends on condition
View Answer
3. Is there any error in executing the following MySQL command?
b) No
c) Depends
View Answer
c) To modify the column name while using literals, Expression, built_in functions with “SELECT clause
View Answer
SELECT emp_id,
‘ACTIVE’ STATUS,
FROM employee;
View Answer
SELECT emp_id,
‘ACTIVE’ AS STATUS,
FROM employee;
c) Error
View Answer
a) DISTINCTS
b) MODIFY
c) DISTINCT
View Answer
8. If in Table “account”, a column “cust_id” consists of {1,2,2,3,3,5,6,7,8,8} then what will be the
output on executing the following MySQL statement?
a) {1, 2, 2, 3, 3, 5, 6, 7, 8, 8}
b) {1, 2, 3, 5, 6, 7, 8}
c) { }
View Answer
9. If in Table “employee”, a column “emp_id” consists of {1,2,2,3,3,5,6,7,8,8} then what will be the
output on executing the following MySQL statement?
FROM employee;
a) {1,2,2,3,3,5,6,7,8,8}
b) {1,2,3,5,6,7,8}
c) { }
View Answer
a) DISTINICTS
b) ALL
c) AS
a) Permanent Tables
b) Virtual tables
c) Temporary tables
View Answer
a) Permanent Tables
b) Virtual tables
c) Temporary tables
View Answer
a) Permanent Tables
b) Virtual tables
c) Temporary tables
View Answer
b) Permanent tables
c) Virtual tables
d) All of the mentioned
View Answer
a) FROM
b) WHERE
c) ORDER BY
View Answer
View Answer
_________person;
a) FROM
b) WHERE
c) SELECT
View Answer
9. In the following MySQL query, “person_1” belongs to which category of table in MySQL?
a) Permanent Tables
b) Virtual tables
c) Temporary tables
View Answer
a) CREATE TABLE;
b) CREATE VIEW
View Answer
View Answer
ON e.dept_id=e.dept_id;
a) NO
b) YES
c) DEPEND
View Answer
ON e.dept_id=e.dept_id;
a) NO
b) YES
c) DEPEND
View Answer
4. What will be the output of the following MySQL statement “true AND Null”?
a) True
b) Null
c) Depend
View Answer
5. What will be the output of the following MySQL statement “false AND Null”?
a) False
b) Null
c) Depend
View Answer
6. What will be the output of the following MySQL statement “Null AND Null”?
a) True
b) Null
c) False
View Answer
7. What will be the output of the following MySQL statement “true OR Null”?
a) True
b) Null
c) False
View Answer
8. What will be the output of the following MySQL statement “false OR Null”?
a) True
b) Null
c) False
View Answer
9. What will be the output of the following MySQL statement “Null OR Null”?
a) True
b) Null
c) False
View Answer
10. What will be the output of the following MySQL statement “NOT (Null)”?
a) True
b) Null
c) False
View Answer
View Answer
SELECT *
FROM employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title”
c) All columns don’t belong to table employee
View Answer
SELECT *
FROM employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” and 2013-01-24 as a
“start_date”
View Answer
SELECT *
FROM employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” or 2013-01-24 as a
“start_date”
View Answer
5. What will be the output of the following MySQL command?
SELECT *
FROM employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” and start_date are
greater than 2013-01-24
View Answer
SELECT *
FROM employee
b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” OR start_date are
greater than 2013-01-24
View Answer
FROM employee
WHERE title=’HEAD TELLER’;
a) All columns
c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a
“title”
View Answer
FROM employee
a) All columns
c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a
“title” and start_date as 2008-11-24
View Answer
FROM employee
a) All columns
c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a
“title” and start_date>2008-11-23
d) None of the mentioned
View Answer
View Answer
a) SELECT
b) WHERE
c) FROM
View Answer
View Answer
a) Aggregate functions
b) Operators
c) Clauses
d) All of the mentioned
View Answer
a) COUNT
b) UPPER
c) LOWER
View Answer
a) COUNT
b) SUM/AVG
c) MIN/MAX
View Answer
a) GROUP BY
b) SELECT
c) WHERE
View Answer
8. What is the significance of the statement “GROUP BY d.name” in the following MySQL statement?
ON d.dept_id=e.emp_id
GROUP BY d.name
View Answer
9. What is the significance of the statement “HAVING COUNT (emp_id)>2” in the following MySQL
statement?
ON d.dept_id=e.emp_id
GROUP BY d.name
c) Filter out all rows whose total emp_id below 2 & Selecting those rows whose total emp_id>2
View Answer
a) Yes
b) No
c) Depends
View Answer
2. What is the meaning of “ORDER BY” clause in Mysql?
b) Aggregation of fields
View Answer
FROM person
ORDER BY emp_id;
View Answer
FROM person
View Answer
5. If emp_id contain the following set {9, 7, 6, 4, 3, 1, 2}, what will be the output on execution of the
following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {1, 2, 3, 4, 6, 7, 9}
b) {2, 1, 4, 3, 7, 9, 6}
c) {9, 7, 6, 4, 3, 1, 2}
View Answer
6. If emp_id contain the following set {1, 2, 3, 4, 1, 1}, what will be the output on execution of the
following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {1, 1, 1, 2, 3, 4}
b) {1, 2, 3, 4, 1, 1}
c) {1, 1, 2, 3, 4, 1}
View Answer
7. If emp_id contain the following set {1, 2, 2, 3, 3, 1}, what will be the output on execution of the
following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {1, 1, 2, 2, 3, 3}
b) {1, 2, 3, 3, 2, 1}
c) {2, 2, 1, 1, 3, 3}
View Answer
8. If emp_id contain the following set {-1, -2, 2, 3, -3, 1}, what will be the output on execution of the
following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
View Answer
9. Which keyword is used for sorting the data in descending order in Mysql?
a) DESC
b) ASC
c) ALTER
d) MODIFY
View Answer
10. Which keyword is used for sorting the data in ascending order in Mysql?
a) DESC
b) ASC
c) ALTER
d) MODIFY
1. Keyword “ASC” and “DESC” cannot be used without which clause in Mysql?
a) ORDER BY
b) GROUP BY
c) SELECT
d) HAVING
View Answer
2. What is the significance of “ORDER BY emp_id DESC” in the following MySQL command?
FROM person
View Answer
3. What is the significance of “ORDER BY emp_id ASC” in the following MySQL command?
View Answer
4. If emp_id contain the following set {9, 7, 6, 4, 3, 1, 2}, what will be the output on execution of the
following MySQL command?
SELECT emp_id
FROM person
a) {9, 7, 6, 4, 3, 1, 2}
b) {1, 2, 3, 4, 6, 7, 9}
c) {2, 1, 3, 4, 6, 7, 9}
View Answer
5. If emp_id contain the following set {9, 7, 6, 4, 3, 1, 2}, what will be the output on execution of the
following MySQL command?
SELECT emp_id
FROM person
a) {9, 7, 6, 4, 3, 1, 2}
b) {1, 2, 3, 4, 6, 7, 9}
c) {2, 1, 3, 4, 6, 7, 9}
View Answer
a) GROUP BY
b) DESC
c) ASC
d) ORDER BY
View Answer
FROM person
a) Yes
b) No error
c) Depends
View Answer
FROM person
b) No error
c) Depends
View Answer
FROM person
ORDER BY 2, 5;
a) Yes
b) No
c) Depends
View Answer
a) AND
b) OR
c) NOT
View Answer
View Answer
View Answer
a) NOT(true)=false
b) NOT(false)=true
View Answer
View Answer
View Answer
a) Only tellers who began working for the bank prior to 2007 will be included
b) Any employee who is either not a teller or began working for the bank in 2007 or later will be
removed from consideration
c) Only tellers who began working for the bank prior to 2007 will not be included
View Answer
c) The employee is something other than a teller but was employed prior to 2007
View Answer
c) Only those employee will be selected who joined the organisation prior to 2007
View Answer
a) The result set contains non terminated employees who both are non tellers and started working
for the bank from 2007 or later
b) The result set contains employees who both are tellers and started working for the bank in 2007
or later
View Answer
a) Equality Conditions
b) Inequality Conditions
c) Range condition
d) Between
View Answer
SELECT fname
FROM person
WHERE title=’TELLER’;
a) Equality condition
b) Inequality condition
c) Range condition
View Answer
SELECT fname
FROM person
WHERE fed_id=’111-11-111’;
a) Equality condition
b) Inequality condition
c) Range condition
View Answer
SELECT fname
FROM person
a) Equality condition
b) Inequality condition
c) Range condition
View Answer
5. Is the following MySQL statement belongs to the “Equality condition”?
ON product_type.dept=Product.dept
WHERE product_type.name=’customers_accounts’;
a) Yes
b) No
c) Depends
View Answer
a) Equal to
b) Not equal to
View Answer
a) Not equal to
b) Equal to
View Answer
8. Does the following MySQL statement belong to the “Inequality condition”?
ON product_type.dept=Product.dept
WHERE product_type.name<>’customers_accounts’;
a) Yes
b) No
c) Depends
View Answer
ON product_type.dept=Product.dept
a) Yes
b) No
c) Depends
View Answer
View Answer
2. Which among the following data types can be used with “Range Condition”?
View Answer
FROM account
WHERE start_date<’2007-10-08’;
a) Equality conditions
b) Inequality condition
c) Range condition
View Answer
SELECT *
FROM employee
View Answer
View Answer
SELECT *
FROM employee
Start_date<=’2005-01-01’
c) Empty set
View Answer
FROM account
a) Only those details will be shown whose as available balance form 3000 to 5000
b) Only those details will be shown whose available balance is more than 3000
c) Only those details will be shown whose available balance is less than 5000
View Answer
a) <>
b) !=
c) =
View Answer
a) <>
b) !=
c) =
d) >/<
View Answer
10. Which among the following operators is/are belongs to “Range conditions”?
a) <>
b) !=
c) =
d) >/<
View Answer
FROM customer
a) Yes
b) No
View Answer
FROM account
a) Only those values are selected whose product_id is either ‘sav’, ‘chd’, ‘mm’
c) Only those values are selected whose product_id is either ‘sav’, ‘chd’
View Answer
FROM account
a) Only those values are selected whose product_id does not belong to either ‘sav’, ‘chd’, ‘mm’
b) Only those values are selected whose product_id does not belong to either ‘sav’’
c) Only those values are selected whose product_id does not belong to either ‘sav’, ‘chd’
View Answer
4. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.
Intern_id = {1, 2, 3, 4, 5, 6}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
View Answer
5. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.
Intern_id= {1, 2, 3, 4, 5, 6}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
View Answer
6. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject,
subject_value.
Intern_id = {1, 2, 3, 4, 5, 6}
Subject_value = {0, 0, 1, 1, 2, 2, 3, 3}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
View Answer
7. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject,
subject_value.
Intern_id = {1, 2, 3, 4, 5, 6}
Subject_value = {0, 0, 1, 1, 2, 2, 3, 3}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
WHERE subject IN (SELECT subject FROM sanfoundry WHERE subject_value IN (3, 2));
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
d) {1, 2, 3, 4, 5, 6}
View Answer
8. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.
Intern_id = {1, 2, 3, 4, 5, 6}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
d) {1, 4}
View Answer
9. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.
Intern_id = {1, 2, 3, 4, 5, 6}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
d) {2, 4, 5, 6}
View Answer
10. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.
Intern_id = {1, 2, 3, 4, 5, 6}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM sanfoundry
a) {5, 6}
b) {1, 2, 3}
c) {3, 4}
d) Empty set
View Answer
FROM employee
a) Only those employees are selected whose last name started with ‘T’
b) Only those employees are selected whose last name started with other than ‘T’
View Answer
FROM employee
a) Only those employees are selected whose last name started with ‘F’
b) Only those employees are selected whose last name started with other than ‘F’
View Answer
FROM employee
WHERE LEFT (fname, 1) =’F’;
a) Only those employees are selected whose first name started with ‘F’
b) Only those employees are selected whose first name started with other than ‘F’
View Answer
FROM employee
a) Only those employees are selected whose first name and last name started with ‘F’
b) Only those employees are selected whose first name started with ‘F’ but last name can be starts
with any other letter
c) Only those employees are selected whose first name and last name started with any other letter
except ‘F’
View Answer
SELECT *
FROM employee
a) All employees whose last name start with any letter but second letter should be ‘a’
b) All employees whose last name start with any letter but contain at least one ‘e’ in his name
c) All employees whose last name should have letter ‘a’ in second position and at least one ‘e’ in his
name
d) All of the mentioned
View Answer
SELECT *
FROM employee
c) All employees whose last name should started with ‘F’ and end with ‘T’
View Answer
SELECT *
FROM employee
a) All employees whose last name should started with ‘F’ and end with ‘T’
b) All employees whose last name start with ‘T’ and end with ‘F’
c) All employees whose last name should started with ‘F’ and end with ‘F’
View Answer
FROM employee
c) All employees whose last name should contain substring “bas” or first name should contain
substring “bbs”
View Answer
SELECT *
FROM employee
a) All employees whose last name contain ‘t’ in the second position
b) All employees whose last name contains ‘f’ in the fourth position
c) All employees whose last name contains ‘n’ in second last position
View Answer
a) Not applicable
c) Value undefined
View Answer
a) True
b) False
View Answer
a) True
b) False
View Answer
a) IS NULL
b) NOT NULL
c) ON
View Answer
a) IS NULL
b) NOT NULL
c) ON
View Answer
FROM person
c) No output
View Answer
SELECT *
FROM person
c) No output
View Answer
SELECT *
FROM person
View Answer
SELECT fname
FROM person
WHERE emp_id != 6;
c) No output
View Answer
SELECT fname
FROM person
a) Only those names whose emp_id is not equal to 6 or emp_id with NULL values
View Answer
9: In a LIKE clause, you can could ask for any value ending in “ton” by writing
A. LIKE ton$
B. LIKE ^.*ton$
C. LIKE %ton
D. LIKE *ton
E. LIKE .*ton
Ans: C
A. Alter
B. Add
C. Insert
D. Create
E. Update
F. Commit
Ans: C
11: Which of these commands will delete a table called XXX if you have appropriate authority:
A. DROP XXX
E. DELETE XXX
Ans: D
Ans: C
13: In a LIKE clause, you can ask for any 6 letter value by writing:
A. LIKE ??????
B. LIKE .{6}
C. LIKE ^.{6}$
Ans: E
19: Which of these is a valid call to a function (watch the spaces carefully!)
A. CONCAT( A , B )
B. CONCAT ( A , B )
E. CONCAT (A, B)
Ans: C
25: In a LIKE clause, you can ask for any 6 letter value by writing:
B. LIKE .{6}
C. LIKE ??????
D. LIKE ^.{6}$
Ans: A
B. From
C. Far
D. Near
Ans: B
36. To remove duplicate rows from the result set of a SELECT use the following keyword:
a) NO DUPLICATE
b) UNIQUE
c) DISTINCT
ANSWER: c
37. In a LIKE clause, you can could ask for any value ending in “qpt” by writing
a) LIKE %qpt
b) LIKE *ton
c) LIKE ton$
d) LIKE ^.*ton$
ANSWER: a
39. Primary Key does allow the Null Values. where as in Unique key doesn’t accept the Null values.
Question:
True or False ?
a) False
b) True
ANSWER: a
41. In a SELECT with a GROUP BY clause, a WHERE clause, and a HAVING clause, the WHERE
conditions are applied before the HAVING conditions.
a) True
b) Fasle
c) Either True or False
ANSWER: a
42. In a LIKE clause, you can could ask for any value ending in “ton” by writing?
A. LIKE ton$
B. LIKE ^.*ton$
C. LIKE %ton
D. LIKE *ton
E. LIKE .*ton
Ans: C
43. Which of these commands will delete a table called XXX if you have appropriate authority?
A. DROP XXX
E. DELETE XXX
Ans: D
Answer : A
B. ORDER BY
C. ARRENGE BY
Answer : B
49. In order to add a new column to an existing table in SQL, we can use the command
A. MODIFY TABLE
B. EDIT TABLE
C. ALTER TABLE
D. ALTER COLUMNS
Answer : C
can be duplicated
can be null
cannot be null
none of these
DML Statement
DDL Statement
Query Statement
Show Answer
Added By : Tushar
Like (1)
SELECT
CREATE
AVG
MODIFY
Show Answer
Added By : Mahesh
composite keys.
determinants
foreign keys
candidate keys
A attribute in a relation is a foreign key if the _______ key from one relation is used as an attribute in
that relation .
Candidate
Primary
Super
Sub
Which one of the following provides the ability to query information from the database and to insert
tuples into, delete tuples from, and modify tuples in the database ?
Query
Relational Schema
Show Answer
Like (0)
Create table employee (name varchar ,id integer) What type of statement is this ?
DML
View
DDL
Integrity constraint
Insert into instructor values (10211, 'Smith', 'Biology', 66000); What type of statement is this?
Query
DML
Relational
DDL
Record
Column
Tuple
Key
Show Answer
Like (1)
Cardinality
Entity
Tuples
Degree
Show Answer
Like (1)
drop db dbname
Like (0)
Primary Key
Sub Key
Super Key
Foreign Key
Show Answer
Added By : Rahul
Alternate Keys
Foreign Keys
Candidate Keys
Composite Keys
Show Answer
Like (4)
In order to add a new column to an existing table in SQL, we can use the command
MODIFY TABLE
EDIT TABLE
ALTER TABLE
ALTER COLUMNS
Show Answer
Added By : Amitosh
Like (2)
Added By : Amitosh
INSERT INTO job_question VALUES ('col1', 'col2'), VALUES ('col1', 'col2'), ...
A and B Both
Show Answer
Added By : Akash
The DISTINCT keyword used along with the SELECT keyword retrieves ______ ?
Added By : Rajat
Like (5)
Which clause is used to sort the result of SELECT statement?
SORT BY
ORDER BY
ARRENGE BY
Which statement is used to find out what databases currently exist on the server?
SHOW DATABASE
SHOW DATABASES