Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
250 views

SQL MCQS

The document provides answers to multiple choice questions about MySQL. MySQL is a relational database management system that is open source and freely available. Data in MySQL is organized into tables which are made up of rows and columns. Communication with MySQL is established through SQL. Tables have columns that represent attributes, and rows that represent tuples.

Uploaded by

Vandana Dulani
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
250 views

SQL MCQS

The document provides answers to multiple choice questions about MySQL. MySQL is a relational database management system that is open source and freely available. Data in MySQL is organized into tables which are made up of rows and columns. Communication with MySQL is established through SQL. Tables have columns that represent attributes, and rows that represent tuples.

Uploaded by

Vandana Dulani
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 116

1. Which type of database management system is MySQL?

a) Object-oriented

b) Hierarchical

c) Relational

d) Network

View Answer

2. What is data in a MySQL database organized into?

a) Objects

b) Tables

c) Networks

d) File systems

View Answer

3. MySQL is freely available and is open source.

a) True

b) False

View Answer

4. What represents an ‘attribute’ in a relational database?

a) Table

b) Row

c) Column

d) Object

View Answer

5. What represents a ‘tuple’ in a relational database?


a) Table

b) Row

c) Column

d) Object

View Answer

6. How is communication established with MySQL?

a) SQL

b) Network calls

c) A programming language like C++

d) APIs

View Answer

7. What does ‘name’ represent in the following SQL code snippet?

CREATE TABLE student

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

d) Server daemon program

View Answer

9. The MySQL server used in its client/server architecture is _______________

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?

SHOW COLUMNS FROM tbl_name LIKE '%name';

a) suffixed with ‘name’

b) prefixed with ‘name’

c) suffixed with ‘%name’

d) prefixed with ‘%name’

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

4. In the following SQL code, InnoDB is __________

CREATE TABLE student (

name CHAR(30),

student_id INT,

PRIMARY KEY (student_id)

) ENGINE = InnoDB;

a) database name

b) table name

c) reference engine

d) storage engine
View Answer

5. Identify the table name in the following SQL statement.

INSERT INTO student VALUES('Kyle','M',NULL);

a) Student

b) Values

c) Kyle

d) M

View Answer

6. What is ‘xyz’ in the following SQL statement?

SELECT abc FROM xyz;

a) row name

b) column name

c) table name

d) database name

View Answer

7. Which operator is used to perform integer divisions in MySQL?

a) /

b) \

c) DIV

d) //

View Answer
8. The NULL value also means ___________

a) value equal to zero

b) unknown value

c) negative values

d) a large value

View Answer

9. What does comparing a known value with NULL result into?

a) zero

b) a positive value

c) a negative value

d) null

View Answer

10. Which clause is used to sort query elements?

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

2. The number of attributes in the following SQL table is ______________


CREATE TABLE employee (

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

4. What is the host name in the following MySQL command?

mysql -h cobra.snake.net -p -u sampadam

a) cobra.snake

b) cobra.snake.net

c) sampadam

d) cobra

View Answer

5. What is ‘tamp’ in the following MySQL command?


mysql -h xyz.host.try.net -p -u tamp

a) user name

b) password

c) host name

d) table name

View Answer

6. The query ‘SELECT NOW()’ shows the current _____________

a) table

b) time only

c) date only

d) date and time

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()

b) SELECT DATABASE sampledb

c) USE DATABASE sampledb

d) USE sampledb

View Answer

8. What does ‘abc’ & ‘xyz’ specify in the following SQL statement?

CREATE TABLE abc (xyz);

a) table name and column specs

b) column specs and table name


c) table name and number of columns

d) table name and number of rows

View Answer

9. To see the table structure, which of the following SQL commands is issued?

a) DESCRIBE tbl_name

b) VIEW tbl_name

c) SELECT TABLE 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

2. What does Control-_ do in MySQL input editor?

a) copies to clipboard

b) pastes from clipboard

c) undoes last change

d) deletes the current line


View Answer

3. On UNIX, statements entered in ‘MySQL’ are saved in which file?

a) .mysql_queries

b) .queries

c) .mysql_history

d) .history

View Answer

4. MySQL can be used to execute script files.

a) True

b) False

View Answer

5. Suppose run_me.sh is a script file. Which command is used to make it executable?

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?

a) mysql exec.sql > sampdb

b) mysql sampdb < exec.sql

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

10. In UNIX, the name of the option file is __________

a) .my.cnf

b) .my.ini

c) .my.opt

d) .my.opc

View Answer

1. Which of the following characters is illegal in naming an unquoted identifier in SQL?


a) _

b) $

c) 2

d) .

View Answer

2. In MySQL, identifier names can start with a digit.

a) True

b) False

View Answer

3. How are identifiers quoted in MySQL?

a) single quotes

b) double quotes

c) backticks

d) can’t be quoted

View Answer

4. Which of the following is an illegal unquoted identifier name?

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

7. What is the maximum length for alias names in terms of characters?

a) 64

b) 128

c) 256

d) 32

View Answer

8. What does a fully qualified table name consist of?

a) only the table name

b) only the database name

c) table name followed by database name

d) database name followed by table name

View Answer

9. If no database has been selected, specifying a database qualifier is necessary.


a) True

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?

a) SELECT * FROM `sampledb.member`

b) SELECT * FROM `sampledb`.`member`

c) SELECT * FROM `member`.`sampledb`

d) SELECT * FROM `member.sampledb`

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

2. What is true about the following SQL statement?

SELECT * FROM table_1;

a) invalid

b) display contents of table_1

c) improper case being used

d) display only column names in table_1

View Answer

3. The default case sensitivity of database and table names depends on ___________

a) SQL server

b) Server SQL mode


c) Operating system of machine

d) Does not depend on anything

View Answer

4. Which of the following is case sensitive?

a) Stored function name

b) Stored procedure name

c) Trigger name

d) Event name

View Answer

5. Which variable is used to set table alias names as non-case sensitive?

a) lower_case_table_names

b) lower_case_all

c) lower_case_alias

d) lower_case_aliases

View Answer

6. Which case does InnoDB store database names in?

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

8. Which of the following is case sensitive in MySQL?

a) Event names

b) Logfile group names

c) Column names

d) Indexes

View Answer

9. Which property determines whether a database object is a case sensitive?

a) COLLATION

b) ATOMICITY

c) COLLABORATION

d) NORMALIZATION

View Answer

10. What is AI in terms of database collation?

a) Accent Insensitive

b) Augment Insensitive

c) Articulate Insensitive

d) Addition Insensitive

View Answer

1. Which statement is used to select a default database?

a) USE

b) CREATE

c) DROP
d) SCHEMA

View Answer

2. Which keyword is the synonym for DATABASE?

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

4. Which keyword is used to create a database?

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

6. To create a database only if it doesn’t already exist, which clause is used?

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

9. Which statement is used to see the definition for an existing database?

a) SHOW CREATE DATABASE

b) SHOW DATABASE

c) SHOW CREATE

d) SHOW CREATE DATABASE TABLE

View Answer
10. Which statement makes changes to the database’s global attributes?

a) CHANGE

b) ALTER

c) ALTERNATE

d) UPDATE

1. Which statement is used to remove indexes on tables?

a) DROP INDEX

b) DELETE INDEX

c) REMOVE INDEX

d) FLUSH INDEX

View Answer

2. Which storage engine is not available in MySQL 5.0?

a) InnoDB

b) ARCHIVE

c) Falcon

d) NDB

View Answer

3. The default storage engine used is ____________

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

6. Which keyword is used to create a table as a temporary copy of itself?

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

8. It is possible to drop multiple tables in the same statement.


a) True

b) False

View Answer

9. The default index type for MEMORY tables is __________

a) HASH

b) SPATIAL

c) FULLTEXT

d) UNIQUE

View Answer

10. The statement to change the table name is __________

a) CHANGE

b) CHANGENAME

c) CHANGENM

d) RENAME

1. SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns; Which of


these is not optional?

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

4. The clause that filters JOIN results is called _________

a) WHERE

b) SORT

c) GROUP

d) GROUP BY

View Answer

5. CROSS JOIN and JOIN are similar to __________

a) INNER JOIN

b) NATURAL JOIN

c) OUTER JOIN

d) CARTESIAN JOIN

View Answer

6. The comma operator can also be used to join tables.

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

8. What is joining a table to itself called?

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

2. Which subquery returns a single value?

a) scalar

b) column

c) row

d) table

View Answer

3. Usage of aggregates in WHERE clause is allowed.

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

b) EXISTS and NOT EXISTS

c) OUTER JOIN and INNER JOIN

d) LEFT JOIN and RIGHT JOIN

View Answer

5. The ALL subquery performs which operation?


a) row

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

7. Which operators test whether a subquery returns any rows?

a) IN and NOT IN

b) EXISTS and NOT EXISTS

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

9. Which subquery cannot be executed by itself as a separate statement?

a) Correlated
b) Uncorrelated

c) EXISTS

d) NOT EXISTS

View Answer

10. Which of these operators does not perform relative-value comparisons?

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

2. What is ‘xyz’ in the following SQL statement?

SELECT xyz FROM table1 UNION xyz FROM table2;

a) row name

b) column name

c) table name

d) database name

View Answer

3. The following SQL statement is invalid.


SELECT abc, xyz FROM table1 UNION abc, def FROM table2;

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

5. Which keyword used with UNION retains duplicate rows?

a) ALL

b) NARROW

c) STRICT

d) DISTINCT

View Answer

6. The UNION ALL has a higher precedence than UNION DISTINCT.

a) True

b) False

View Answer

7. Which clause is used to sort a UNION result as a whole?

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

9. Which table is used to run a UNION-type query on MyISAM tables?

a) TRADITIONAL

b) MERGE

c) SERVELET

d) UNITE

View Answer

10. SELECT on a MERGE table is like _____________

a) UNION ALL

b) UNION

c) UNION DISTINCT

d) JOIN

1. To perform a delete on a single-table, how is the name of a column qualified?

a) qualification not necessary

b) column name
c) table name

d) database name

View Answer

2. What is xyz in the following SQL statement?

DELETE FROM xyz WHERE abc = 5;

a) column name

b) table name

c) row name

d) database name

View Answer

3. A multiple-table delete can apply any join.

a) True

b) False

View Answer

4. What is abc in the following SQL statement?

DELETE FROM xyz WHERE abc = 5;

a) column name

b) table name

c) row name

d) database name

View Answer
5. What is x in the following MySQL statement?

DELETE FROM x USING x LEFT JOIN y ON x.col = y.col;

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

7. What is the value of val2 in the following MySQL statement?

UPDATE t SET val1 = val1 + 2, val2 = val1;

a) previous val1

b) updated val1

c) unchanged

d) val1 + 1

View Answer

8. UPDATE statement is a DML statement. What does DML stand for?

a) Data Manipulation Language

b) Data Manipulation Level

c) Data Markup Language


d) Data Markup Level

View Answer

9. Which keyword in the UPDATE statement is used to assign values to columns?

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?

a) CREATE TABLE name;

b) CREATE name;

c) CREATE TABLE

d) All of the mentioned

View Answer

2. What is the role of “CONSTRAINS” in defining a table in Mysql?

a) Declaring primary key

b) Declaring Foreign Key

c) Restrictions on columns

d) All of the mentioned


View Answer

3. Which command is used for the table definition in Mysql?

a) DESC table_name;

b) DESC table_name

c) DESC

d) None of the mentioned

View Answer

4. Which among the following is the correct syntax for defining “Constraint Check” in Mysql?

a) gender char(1) check( gender IN (‘M’, ‘F’)),

b) gender char (1) check,

c) gender char (1) check ( gender ),

d) none of the mentioned

View Answer

5. Which data type character merges the “Check Constraint” into a data type definition?

a) ENUM

b) ENUM1

c) ENUM2

d) None of the mentioned

View Answer

6. Which among the following is the correct syntax for defining “ENUM” in Mysql?

a) gender ENUM (‘M’, ‘F’),

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

d) All of the mentioned

View Answer

8. Find out the logical error in the following MySQL code snippet?

CREATE TABLE person

( person_id VARCHAR(20),

Name VARCHAR (20),

Address VARCHAR (20),

Mobile_no SMALLINT

);

a) Lesser number of columns

b) Incorrect definition

c) Primary key is missing

d) None of the mentioned

View Answer

9. What is the meaning of “REFERENCES” in table definition?

a) Primary key

b) NULL
c) Foreign Key

d) A ”foreign Key” belong to this particular table

View Answer

10. What default value gets stored in columns of the table?

a) NULL

b) 0

c) 1

d) -1

1. Which Statement is used to insert the values in the table?

a) INSERT INTO

b) Insert

c) INSERT

d) None of the mentioned

View Answer

2. Is it necessary to insert the value in each column of the table?

a) Yes

b) No

c) Depends on the server

d) Depends on the usage of the table

View Answer

3. In the following SQL query, what does “person” stands for?

INSERT INTO person

(person_id, fname, lname)


VALUES (1,’S’,’P’);

a) Composite attributes

b) Multivalued attributes

c) Table name

d) None of the mentioned

View Answer

4. In the following SQL query, what does “person_id” stands for?

CREATE TABLE person

(person_ id SMALLINT UNSIGNED,

fname VARCHAR(20),

lname VARCHAR(20),

CONSTRAINT pk_person PRIMARY KEY (person_id));

a) Normal attribute of the table

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

d) All of the mentioned

View Answer

7. Which among the following is the correct syntax for modifying the definition of an existing table?

a) ALTER TABLE person MODIFY person_id SMALLINT UNSIGNED AUTO_INCREMENT;

b) ALTER TABLE person person_id SMALLINT UNSIGNED AUTO_INCREMENT;

c) ALTER TABLE person MODIFY person_id ;

d) ALTER TABLE person

View Answer

8. Will the following SQL command produce any error?

INSERT INTO person

(person_id, fname,lname)

VALUES (1,’S’,’U’),

VALUES (1,’T’,’U’);

/* where person_id is a primary key */

a) Error

b) No Error

c) Depends

d) None of the mentioned

View Answer
9. Will the following SQL command produce any error?

INSERT INTO person

(person_id, fname,lname)

VALUES (1,’S’,’U’),

VALUES (2,’T’,’U’);

/* where person_id is a primary key */

a) Error

b) No Error

c) Depends

d) None of the mentioned

View Answer

10. What is the default value of column?

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

2. In the following SQL command “person” stands for?


SELECT person_id, fname, lname, Birth_date

FROM person;

a) Table name

b) Attribute

c) Multivalued attribute

d) None of the mentioned

View Answer

3. In the following SQL command “*” stands for?

SELECT * FROM person;

a) Retrieve all data from the table

b) Retrieve data of primary key only

c) Retrieve NULL data

d) None of the mentioned

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

d) None of the mentioned

View Answer

5. In the following SQL command “person_id” can be ____________

SELECT person_id, fname,l name, Birth_data FROM person


WHERE person_id=1;

a) Only Primary Key

b) Primary Key or any other Attribute

c) Only Attribute but not a primary Key

d) None of the mentioned

View Answer

6. Which Clause is used to sort the stored data in alphabetical order?

a) ORDER by CLAUSE

b) MODIFY

c) ALTER

d) UPDATE

View Answer

7. Which Clause is used to select a particular table in Mysql?

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

d) None of the mentioned

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?

SELECT fruit FROM person

WHERE person_id=1

ORDER BY fruit;

a) apple, mango, banana

b) apple, banana, mango

c) mango, apple, banana

d) none of the mentioned

1. Which statement is used for updating existing information in the table?

a) UPDATE

b) WHERE

c) MODIFY

d) ALTER

View Answer

2. Which statement is used to delete an existing row from the table?

a) DELETE

b) WHERE
c) MODIFY

d) None of the mentioned

View Answer

3. In the following MySQL command how many rows will be updated?

UPDATE person

SET lname=’s’,

Fname = ’p’,

WHERE person_id = 1;

/* person_id is a primary key */

a) Single row

b) Double row

c) No row

d) None of the mentioned

View Answer

4. In the following MySQL command how many rows will be updated?

UPDATE person

SET lname=’s’,

Fname=’p’,

WHERE person_id&lt;10;

/* person_id is a primary key */

a) 0-9

b) 1-6

c) No row
d) None of the mentioned

View Answer

5. In the following MySQL command how many rows will be deleted?

DELETE person

WHERE person_id=1;

/*person_id is a primary key */

a) 1

b) 0

c) No row

d) None of the mentioned

View Answer

6. In the following MySQL command how many rows will be deleted?

DELETE person

WHERE person_id&lt;10;

/*person_id is a primary key */

a) 0-9

b) 1-7

c) No row

d) None of the mentioned

View Answer

7. “INSERT” is same as “UPDATE”?

a) NO
b) YES

c) May be

d) None of the mentioned

View Answer

8. Which clause is used to rename the existing table?

a) RENAME

b) MODIFY

c) ALTER

d) None of the mentioned

View Answer

9. Which of the following functions are not performed by “ALTER” clause?

a) Change the name of the table

b) Change the name of the column

c) Drop a column

d) All of the mentioned

1. Character data can be stored as ______________

a) Fixed length string

b) Variable length string

c) Either Fixed or Variable length string

d) None of the mentioned

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

d) None of the mentioned

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

c) Both Varchar and Char

d) None of the mentioned

View Answer

4. The maximum length of the char columns is ____________

a) 255 bytes

b) 65, 535 bytes

c) 256 bytes

d) None of the mentioned

View Answer

5. The maximum length of the varchar columns is ____________

a) Upto 65, 535 bytes

b) Upto 256 bytes

c) Upto 65, 567 bytes

d) None of the mentioned

View Answer

6. In oracle database variable length column is declared by ____________

a) Varchar
b) Varchar 3

c) Varchar2

d) None of the mentioned

View Answer

7. Mysql support different character sets, which command is used to display all character sets?

a) SHOW CHARACTER SET;

b) SHOW;

c) CHARACTER SET;

d) None of the mentioned

View Answer

8. Which one is the correct declaration for choosing the character set other than default?

a) Varchar(20) character set utf8;

b) Varchar(20);

c) Varchar(20) character set;

d) None of the mentioned

View Answer

9. Which “text type” has the maximum number of bytes?

a) Tiny text

b) Text

c) Medium text

d) Long text

View Answer

10. Which among the following have the maximum bytes?


a) Varchar

b) Char

c) Text type

d) Both Varchar and Char

1. What will happen if the data being loaded into a text column exceeds the maximum size of that
type?

a) Extra memory will be allocated

b) Process terminate

c) Data will be truncated

d) Depend on the system

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

3. Which data type is more suitable for storing “documents” in Mysql?

a) Varchar

b) Longtext

c) Mediumtext

d) Either Varchar or Longtext

View Answer

4. “Numeric Data” is used to store ____________

a) Whole numbers
b) Natural numbers

c) Rational numbers

d) Both Whole and Natural numbers

View Answer

5. Which Numeric Data type has the largest range?

a) Mediumint

b) Smallint

c) Int

d) Tinyint

View Answer

6. What will be the storage pattern for “float(4,2)” in Mysql?

a) Total of four digits, two to the left of decimal and two to the right of decimal

b) Total of six digits

c) Total of four digits, not distributed uniformly

d) None of the mentioned

View Answer

7. Which among the following are the correct representation of “float(4,2)”?

a) 24.33

b) 124.4

c) 12.123

d) Both 24.33 and 124.4

View Answer

8. Which among the following is the correct representation of “float(5,0)”?


a) 12345.123

b) 12345.1

c) 12345

d) 123.123

View Answer

9. Which among the following is the correct representation of “float(1,1)”?

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) None of the mentioned

1. Which data type is used to store data and time in Mysql?

a) Numeric data type

b) Text data type

c) Temporal data type

d) Char/Varchar

View Answer

2. What is the default format for “Date” data type?

a) YYYY-MM-DD

b) MM-YYYY-DD

c) DD-MM-YYYY

d) None of the mentioned

View Answer

3. What is the default format for “Datetime” data type?

a) YYYY-MM-DD HH:MI:SS
b) MM-YYYY-DD HH:MI:SS

c) DD-YYYY-MM MI:HH:SS

d) None of the mentioned

View Answer

4. What is the default format for “Timestamp” data type?

a) YYYY-MM-DD HH:MI:SS

b) MM-YYYY-DD HH:MI:SS

c) DD-YYYY-MM MI:HH:SS

d) None of the mentioned

View Answer

5. What is the default format for “Year” data type?

a) YYYY

b) YYYY-DD-MM

c) MM-YYYY-DD

d) None of the mentioned

View Answer

6. What is the default format for “Time” data type?

a) HHH:MI:SS

b) SS:MI:HHH

c) MI:SS:HHH

d) None of the mentioned

View Answer

7. Is “Datetime” and “Timestamp” are same data type?


a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer

8. Which value will show an error when stored in float(4,2)?

a) 12.11

b) 13.1

c) 1.12

d) 123.44

1. The datatype for single precision floating point number is ____________

a) FLOAT

b) DOUBLE

c) INT

d) BIGINT

View Answer

2. Which datatype is used for a fixed length binary string?

a) VARCHAR

b) BINARY

c) VARBINARY

d) BLOB

View Answer

3. Which datatype means a variable length non binary string?

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

5. Which spatial datatype is used to store a curve?

a) GEOMETRY

b) POINT

c) LINESTRING

d) POLYGON

View Answer

6. How many of the following attributes are allowed only for numeric types?

UNSIGNED, ZEROFILL, CHARACTER SET, COLLATE

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

8. A DEFAULT value cannot be supplied to TEXT types.

a) True

b) False

View Answer

9. The datatype INT stores ___________

a) 16 bit

b) 32 bit

c) 48 bit

d) 64 bit

View Answer

10. The datatype SMALLINT stores ___________

a) 16 bit

b) 32 bit

c) 48 bit

d) 8 bit

8. The number of strings among the following matched with ‘%all%’ is _____________

Ball, baller, tall, tallest

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

1. Which command is used to remove existing tables or database?

a) DROP TABLE

b) DELETE

c) Either DROP TABLE or DELETE

d) None of the mentioned

View Answer

2. Which command is used to display all the existing tables in a database?

a) SHOW TABLES

b) SHOW TABLE

c) SHOW

d) None of the mentioned

View Answer

3. Is duplicate entry of primary key is allowed in SQL?

a) Yes

b) No

c) Depends

d) None of the mentioned


View Answer

4. Is duplicate entry of other attributes are allowed in SQL?

a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer

5. Which is the correct format to store date in the SQL?

a) DEC-01-1991

b) 01-1991-11

c) 01-DEC-12

d) 1991-11-01

View Answer

6. Which of the following are the valid “database datatypes” in Mysql?

a) Numerical

b) Temporal

c) Text

d) All of the mentioned

View Answer

7. Find the error in the following SQL statement?

CREATE TABLE person

( person_id SMALLINT, name VARCHAR, LAST VARCHAR


CONSTRAINTS pk_person PRIMARY KEY (person_id));

INSERT INTO person

VALUES( person_id, name, LAST)

(1, ’s’, ’p’);

INSERT INTO person

( person_id, name, LAST)

VALUES(1,’s’,’p’);

a) No error

b) Error, Duplicate value

c) Any other error

d) None of the mentioned

View Answer

8. Find the error in the following SQL statement?

CREATE TABLE person

( person_id SMALLINT, name VARCHAR, LAST VARCHAR, Bith_date DATE

CONSTRAINTS pk_person PRIMARY KEY (person_id));

INSERT INTO person

VALUES( person_id, name, LAST, Birth_date)

(1,’s’,’p’, 24-1991-01);

a) In correct data value

b) No error

c) Any other error

d) None of the mentioned

View Answer
9. Which Key is used to link two tables in Mysql?

a) Primary Key

b) Foreign Key

c) Both Primary and Foreign Key

d) None of the mentioned

View Answer

10. Which line of the following statements will produce error?

a) SELECT * FROM person WHERE person_id=1;

b) SELECT pname FROM person;

c) SELECT pname, lname, person_id FROM person;

d) None of the mentioned

View Answer

2. Which among the following tags belong to Data definition language?

a) SELECT

b) FROM

c) WHERE

d) All of the mentioned

View Answer

3. Which among the following tags belong to Data Manipulation language?

a) UPDATE

b) ALTER

c) MODIFY

d) All of the mentioned

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

3. Which clause is used to “Filters out unwanted data”?

a) FROM

b) WHERE

c) SELECT

d) ORDER BY

View Answer

4. Which clause is used to “group rows together by common columns values”?

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

7. Which clause is used to “Modify the existing field of the table”?

a) ALTER

b) FROM

c) SELECT

d) MODIFY

View Answer

8. Which among the following is not a “query clause”?

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()

8. The one that is not optional is _____________

SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns;

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

1. What is the meaning of “SELECT” clause in Mysql?

a) Show me all Columns and rows

b) Show me all columns

c) Show me all rows

d) None of the mentioned

View Answer

Answer: a

Explanation: None.

2. Which of the following clause is evaluated in the last by database server?

a) SELECT

b) WHERE

c) FROM

d) None of the mentioned

View Answer
3. What will be the output of the following SQL statement?

SELECT *

FROM person;

a) Show all rows and columns of table “person”

b) Show all rows of table “person”

c) Show all columns of table “person”

d) None of the mentioned

View Answer

4. What will be the output of of the following SQL statement?

SELECT person_id, Fname, lname

FROM person;

a) Show only columns (person_id, Fname, lname) and rows related to these columns

b) Show only columns (person_id, Fname, lname)

c) Show all rows

d) Show all columns except (person_id, Fname, lname)

View Answer

5. Can “SELECT” clause be used without the clause “FROM”?

a) YES

b) NO

c) DEPENDS

d) None of the mentioned

View Answer
6. Find the error in the following SQL statement?

SELECT *;

a) No Error

b) No table mentioned

c) Depends

d) None of the mentioned

View Answer

7. What will be the output of the following SQL statement?

SELECT * FROM person

WHERE person_id=1;

a) Show all columns but only those rows which belongs to person_id=1

b) Show all columns and rows

c) Shows only columns person_id

d) None of the mentioned

View Answer

8. What will be the output of the following SQL statement?

SELECT person_id, fname, lname

FROM person

WHERE person_id=1;

a) Show only columns(person_id, fname, lname) but only those rows which belongs to person_id=1

b) Show all columns and rows


c) Shows only columns person_id

d) None of the mentioned

View Answer

9. Which clause is mandatory with clause “SELECT” in Mysql?

a) FROM

b) WHERE

c) Both FROM and WHERE

d) None of the mentioned

1. Which among the following can also be included with “SELECT” clause while writing query in
Mysql?

a) Literals

b) Expressions

c) User defined functions

d) All of the mentioned

View Answer

2. Is there any error in executing the following MySQL command?

SELECT emp_id, ‘ACTIVE’,

emp_id * 3.145,

UPPER (lname)

FROM Employee;

a) Yes

b) NO

c) Depends on condition

d) None of the mentioned

View Answer
3. Is there any error in executing the following MySQL command?

SELECT USER (),

VERSION (), DATABASE ();

a) Yes, “FROM” is not used

b) No

c) Depends

d) None of the mentioned

View Answer

4. What is the need of “column Aliases” in “SELECT” clause?

a) To assign a new label to the column in result set

b) To overwrite the existing column name in result set

c) To modify the column name while using literals, Expression, built_in functions with “SELECT clause

d) All of the mentioned

View Answer

5. What will be the result of the following MySQL command?

SELECT emp_id,

‘ACTIVE’ STATUS,

emp_id * 3.14 emp_pi,

UPPER (lname) last_name

FROM employee;

a) emp_id, ACTIVE, emp_id * 314, UPPER(lname)

b) emp_id, Status, emp_pi, last_name


c) Error

d) None of the mentioned

View Answer

6. What will be the result of the following MySQL command?

SELECT emp_id,

‘ACTIVE’ AS STATUS,

emp_id * 3.14 AS emp_pi,

UPPER (lname) AS last_name

FROM employee;

a) emp_id, ACTIVE, emp_id * 314, UPPER(lname)

b) emp_id, Status, emp_pi, last_name

c) Error

d) None of the mentioned

View Answer

7. Which Keyword is used to remove duplicate rows in the result set?

a) DISTINCTS

b) MODIFY

c) DISTINCT

d) All of the mentioned

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?

SELECT DISTINICT cust_id


FROM account;

a) {1, 2, 2, 3, 3, 5, 6, 7, 8, 8}

b) {1, 2, 3, 5, 6, 7, 8}

c) { }

d) None of the mentioned

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?

SELECT DISTINICT emp_id

FROM employee;

a) {1,2,2,3,3,5,6,7,8,8}

b) {1,2,3,5,6,7,8}

c) { }

d) None of the mentioned

View Answer

10. Which among the following is an optional Keyword?

a) DISTINICTS

b) ALL

c) AS

d) Both AS and ALL

1. How can we define the clause “FROM” in Mysql?

a) It defines the tables used by a query

b) It defines the linking of tables in Mysql

c) It defines the tables used by a query & linking of tables in Mysql

d) None of the mentioned


View Answer

2. Which of the following table exist in Mysql?

a) Permanent Tables

b) Virtual tables

c) Temporary tables

d) All of the mentioned

View Answer

3. “CREATE TABLE …” command is used to create which type of table in Mysql?

a) Permanent Tables

b) Virtual tables

c) Temporary tables

d) All of the mentioned

View Answer

4. “CREATE VIEW …” command is used to create which type of table in Mysql?

a) Permanent Tables

b) Virtual tables

c) Temporary tables

d) All of the mentioned

View Answer

5. What is the meaning of “Temporary Tables” in Mysql?

a) Rows returned by sub query

b) Permanent tables

c) Virtual tables
d) All of the mentioned

View Answer

6. “SELECT” clause cannot be used without which clause in Mysql?

a) FROM

b) WHERE

c) ORDER BY

d) All of the mentioned

View Answer

7. Which of the following statements is/are correct with respect to “VIEW”?

a) “VIEW” is a query that stored in the data dictionary

b) There is no data associated with “VIEW”

c) “VIEW” creates virtual tables in Database

d) All of the mentioned

View Answer

8. Find the missing clause from the following SQL statement?

CREATE VIEW person_1 AS

SELECT fname, lname, person_id

_________person;

a) FROM

b) WHERE

c) SELECT

d) None of the mentioned

View Answer
9. In the following MySQL query, “person_1” belongs to which category of table in MySQL?

CREATE VIEW person_1 AS

SELECT fname, lname, person_id FROM person;

a) Permanent Tables

b) Virtual tables

c) Temporary tables

d) None of the mentioned

View Answer

10. Which command is used to create “Temporary tables” in MySQL?

a) CREATE TABLE;

b) CREATE VIEW

c) Both CREATE TABLE; and CREATE VIEW

d) None of the mentioned

View Answer

1. What is the use of “VIEW” in Mysql?

a) To hide columns from the users

b) To hide the complexity of the database

c) To simplify complexity of database design

d) All of the mentioned

View Answer

2. Is there any error in the following MySQL statement?

SELECT e.emp_id, e.fname,e.lname,d.name


FROM employee e INNER JOIN department d

ON e.dept_id=e.dept_id;

a) NO

b) YES

c) DEPEND

d) None of the mentioned

View Answer

3. Is there any error in the following MySQL statement?

SELECT e.emp_id, e.fname,e.lname,d.name

FROM employee AS e INNER JOIN department AS d

ON e.dept_id=e.dept_id;

a) NO

b) YES

c) DEPEND

d) None of the mentioned

View Answer

4. What will be the output of the following MySQL statement “true AND Null”?

a) True

b) Null

c) Depend

d) None of the mentioned

View Answer

5. What will be the output of the following MySQL statement “false AND Null”?
a) False

b) Null

c) Depend

d) None of the mentioned

View Answer

6. What will be the output of the following MySQL statement “Null AND Null”?

a) True

b) Null

c) False

d) None of the mentioned

View Answer

7. What will be the output of the following MySQL statement “true OR Null”?

a) True

b) Null

c) False

d) None of the mentioned

View Answer

8. What will be the output of the following MySQL statement “false OR Null”?

a) True

b) Null

c) False

d) None of the mentioned

View Answer
9. What will be the output of the following MySQL statement “Null OR Null”?

a) True

b) Null

c) False

d) None of the mentioned

View Answer

10. What will be the output of the following MySQL statement “NOT (Null)”?

a) True

b) Null

c) False

d) None of the mentioned

View Answer

1. What is the meaning of the “WHERE” clause in Mysql?

a) Filtering out unwanted rows from result set

b) Filtering out unwanted columns from result set

c) Filtering out unwanted rows and columns from result set

d) None of the mentioned

View Answer

2. What will be the output of the following MySQL command?

SELECT *

FROM employee

WHERE title=’HEAD TELLER’;

a) All columns and rows belong to table employee

b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title”
c) All columns don’t belong to table employee

d) None of the mentioned

View Answer

3. What will be the output of the following MySQL command?

SELECT *

FROM employee

WHERE (title=’HEAD TELLER’) AND (start_date=2013-01-24);

a) All columns and rows belong to table employee

b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” and 2013-01-24 as a
“start_date”

c) All rows belong to table employee

d) None of the mentioned

View Answer

4. What will be the output of the following MySQL command?

SELECT *

FROM employee

WHERE (title=’HEAD TELLER’) OR (start_date=2013-01-24);

a) All columns and rows belong to table employee

b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” or 2013-01-24 as a
“start_date”

c) All rows belong to table employee

d) None of the mentioned

View Answer
5. What will be the output of the following MySQL command?

SELECT *

FROM employee

WHERE (title=’HEAD TELLER’) AND (start_date&gt;2013-01-24);

a) All columns and rows belong to table employee

b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” and start_date are
greater than 2013-01-24

c) All rows belong to table employee

d) None of the mentioned

View Answer

6. What will be the output of the following MySQL command?

SELECT *

FROM employee

WHERE (title=’HEAD TELLER’) OR (start_date&gt;2013-01-24);

a) All columns and rows belong to table employee

b) All columns but only those rows which contain ‘HEAD TELLER’ as a “title” OR start_date are
greater than 2013-01-24

c) All rows belong to table employee

d) None of the mentioned

View Answer

7. What will be the output of the following MySQL command?

SELECT emp_id, fname, lname

FROM employee
WHERE title=’HEAD TELLER’;

a) All columns

b) Only those columns which are mention with “SELECT” clause

c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a
“title”

d) None of the mentioned

View Answer

8. What will be the output of the following MySQL command?

SELECT emp_id, fname, lname

FROM employee

WHERE title=’HEAD TELLER’ AND start_date=2008-11-24;

a) All columns

b) Only those columns which are mention with “SELECT” clause

c) Columns mention with “SELECT” clause and only those rows which contain ‘HEAD TELLER’ as a
“title” and start_date as 2008-11-24

d) None of the mentioned

View Answer

9. What will be the output of the following MySQL command?

SELECT emp_id, fname, lname

FROM employee

WHERE title=’HEAD TELLER’ AND start_date&gt;2008-11-23;

a) All columns

b) Only those columns which are mention with “SELECT” clause

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

1. What is the meaning of “GROUP BY” clause in Mysql?

a) Group data by column values

b) Group data by row values

c) Group data by column and row values

d) None of the mentioned

View Answer

2. Which clause is similar to “HAVING” clause in Mysql?

a) SELECT

b) WHERE

c) FROM

d) None of the mentioned

View Answer

3. What is the meaning of “HAVING” clause in Mysql?

a) To filter out the row values

b) To filter out the column values

c) To filter out the row and column values

d) None of the mentioned

View Answer

4. “COUNT” keyword belongs to which categories in Mysql?

a) Aggregate functions

b) Operators

c) Clauses
d) All of the mentioned

View Answer

5. Which among the following belongs to an “aggregate function”?

a) COUNT

b) UPPER

c) LOWER

d) All of the mentioned

View Answer

6. Which of the following belongs to an “aggregate function”?

a) COUNT

b) SUM/AVG

c) MIN/MAX

d) All of the mentioned

View Answer

7. Which clause is used with an “aggregate functions”?

a) GROUP BY

b) SELECT

c) WHERE

d) Both GROUP BY and WHERE

View Answer

8. What is the significance of the statement “GROUP BY d.name” in the following MySQL statement?

SELECT d.name, COUNT (emp_id) emp_no


FROM department d INNER JOIN Employee e

ON d.dept_id=e.emp_id

GROUP BY d.name

a) Aggregation of the field “name” of both table

b) Aggregation of the field “name” of table “department”

c) Sorting of the field “name”

d) None of the mentioned

View Answer

9. What is the significance of the statement “HAVING COUNT (emp_id)>2” in the following MySQL
statement?

SELECT d.name, COUNT (emp_id) emp_no

FROM department d INNER JOIN Employee e

ON d.dept_id=e.emp_id

GROUP BY d.name

HAVING COUNT (emp_id)&gt;2

a) Filter out all rows whose total emp_id below 2

b) Selecting those rows whose total emp_id>2

c) Filter out all rows whose total emp_id below 2 & Selecting those rows whose total emp_id>2

d) None of the mentioned

View Answer

1. Is “GROUP BY” clause is similar to “ORDER BY” clause?

a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer
2. What is the meaning of “ORDER BY” clause in Mysql?

a) Sorting your result set using column data

b) Aggregation of fields

c) Sorting your result set using row data

d) None of the mentioned

View Answer

3. What is the significance of “ORDER BY” in the following MySQL statement?

SELECT emp_id, fname, lname

FROM person

ORDER BY emp_id;

a) Data of emp_id will be sorted

b) Data of emp_id will be sorted in descending order

c) Data of emp_id will be sorted in ascending order

d) All of the mentioned

View Answer

4. What will be the order of sorting in the following MySQL statement?

SELECT emp_id, emp_name

FROM person

ORDER BY emp_id, emp_name;

a) Sorting {emp_id, emp_name}

b) Sorting {emp_name, emp_id}

c) Sorting (emp_id} but not emp_name


d) None of the mentioned

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}

d) None of the mentioned

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}

d) None of the mentioned

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}

d) None of the mentioned

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;

a) {-3, -2, -1, 1, 2, 3}

b) {-1, 1, -2, 2, -3, 3}

c) {1, 2, 3, -1, -2, -3}

d) None of the mentioned

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?

SELECT emp_id, fname, lname

FROM person

ORDER BY emp_id DESC;

a) Data of emp_id will be sorted in descending order

b) Data of emp_id will be sorted in ascending order

c) Data of emp_id will be sorted in either ascending or descending order

d) All of the mentioned

View Answer

3. What is the significance of “ORDER BY emp_id ASC” in the following MySQL command?

SELECT emp_id, fname, lname


FROM person

ORDER BY emp_id ASC;

a) Data of emp_id will be sorted in descending order

b) Data of emp_id will be sorted in ascending order

c) Data of emp_id will be sorted in either ascending or descending order

d) All of the mentioned

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

ORDER BY emp_id DESC;

a) {9, 7, 6, 4, 3, 1, 2}

b) {1, 2, 3, 4, 6, 7, 9}

c) {2, 1, 3, 4, 6, 7, 9}

d) None of the mentioned

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

ORDER BY emp_id ASC;

a) {9, 7, 6, 4, 3, 1, 2}

b) {1, 2, 3, 4, 6, 7, 9}
c) {2, 1, 3, 4, 6, 7, 9}

d) None of the mentioned

View Answer

6. Find odd one out?

a) GROUP BY

b) DESC

c) ASC

d) ORDER BY

View Answer

7. Is there any error in the following MySQL command?

SELECT emp_id, title, start_date, fname, fed_id

FROM person

ORDER BY RIGHT (fed_id, 3);

a) Yes

b) No error

c) Depends

d) None of the mentioned

View Answer

8. Is there any error in the following MySQL command?

SELECT emp_id, title, start_date, fname, fed_id

FROM person

ORDER BY LEFT (fed_id, 3);


a) Yes

b) No error

c) Depends

d) None of the mentioned

View Answer

9. Is there any error in the following MySQL command?

SELECT emp_id, title, start_date, fname, fed_id

FROM person

ORDER BY 2, 5;

a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer

1. Which of the following operators is/are used in “Condition Evaluation”?

a) AND

b) OR

c) NOT

d) All of the mentioned

View Answer

2. Which of the following statements is/are correct?

a) True AND true =true

b) True AND false= false

c) False AND false= false


d) All of the mentioned

View Answer

3. Which of the following statements is/are correct?

a) True OR true =true

b) True OR false= true

c) False OR false= false

d) All of the mentioned

View Answer

4. Which of the following statements is/are correct?

a) NOT(true)=false

b) NOT(false)=true

c) Both NOT(true)=false and NOT(false)=true

d) None of the mentioned

View Answer

5. Which of the following statements is/are correct?

a) NOT(true AND true) =false

b) NOT(false AND false)=true

c) NOT (true AND false)= true

d) All of the mentioned

View Answer

6. Which of the following statements is/are correct?

a) NOT(true OR true) = false

b) NOT(false OR false)= true


c) NOT (true OR false)= false

d) All of the mentioned

View Answer

7. What will be the result of the following MySQL command?

WHERE TITLE= ‘teller’ AND start_date &lt; ’2007-01-01’

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

d) None of the mentioned

View Answer

8. What will be the result of the following MySQL command?

WHERE TITLE=’teller’ OR start_date=’2007-01-01’

a) The employee is a teller and was employed prior to 2007

b) The employee is a teller and was employed after January 1, 2007

c) The employee is something other than a teller but was employed prior to 2007

d) All of the mentioned

View Answer

9. What will be the result of the following MySQL command?

WHERE end_date IS NULL

AND (title=’teller’ OR start_date &lt; ‘2007-01-01’)

a) Only those rows will be selected whose” end_date” should be NULL


b) Only those rows are selected whose “TITLE” should be ‘teller’

c) Only those employee will be selected who joined the organisation prior to 2007

d) All of the mentioned

View Answer

10. What will be the result of the following MySQL command?

WHERE end_date IS NULL

AND NOT (title=’teller’ OR start_date &lt; ‘2007-01-01’)

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

c) The result set contains employees who are only tellers

d) All of the mentioned

View Answer

1. Select odd one out?

a) Equality Conditions

b) Inequality Conditions

c) Range condition

d) Between

View Answer

2. The following MySQL query belongs to which condition types?

SELECT fname

FROM person

WHERE title=’TELLER’;
a) Equality condition

b) Inequality condition

c) Range condition

d) All of the mentioned

View Answer

3. The following MySQL statement belongs to which condition types?

SELECT fname

FROM person

WHERE fed_id=’111-11-111’;

a) Equality condition

b) Inequality condition

c) Range condition

d) All of the mentioned

View Answer

4. The following MySQL statement belongs to which condition types?

SELECT fname

FROM person

WHERE dept_id= (SELECT dept_id FROM department WHERE names=’s’);

a) Equality condition

b) Inequality condition

c) Range condition

d) All of the mentioned

View Answer
5. Is the following MySQL statement belongs to the “Equality condition”?

SELECT product_type.name, product.name

FROM product_type INNER JOIN Product

ON product_type.dept=Product.dept

WHERE product_type.name=’customers_accounts’;

a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer

6. What is the meaning of “Equality Conditions”?

a) Equal to

b) Not equal to

c) Both Equal to and Not equal to

d) None of the mentioned

View Answer

7. What is the meaning of “Inequality Condition”?

a) Not equal to

b) Equal to

c) Both Not equal to and Equal to

d) None of the mentioned

View Answer
8. Does the following MySQL statement belong to the “Inequality condition”?

SELECT product_type.name, product.name

FROM product_type INNER JOIN Product

ON product_type.dept=Product.dept

WHERE product_type.name<>’customers_accounts’;

a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer

9. Does the following MySQL statement belong to the “Inequality condition”?

SELECT product_type.name, product.name

FROM product_type INNER JOIN Product

ON product_type.dept=Product.dept

WHERE product_type.name! =’customers_accounts’;

a) Yes

b) No

c) Depends

d) None of the mentioned

View Answer

1. What is the meaning of “Range Conditions”?

a) Expression is equal to Expression

b) Expression is not equal to Expression

c) Expression fall under certain range


d) None of the mentioned

View Answer

2. Which among the following data types can be used with “Range Condition”?

a) Numeric data type

b) Temporal data type

c) String data type

d) Both Numeric and Temporal data type

View Answer

3. The following MySQL statement belongs to which “Condition Types”?

SELECT emp_id, fname, lname

FROM account

WHERE start_date<’2007-10-08’;

a) Equality conditions

b) Inequality condition

c) Range condition

d) None of the mentioned

View Answer

4. What will be the output of the following MySQL statement?

SELECT *

FROM employee

WHERE start_date BETWEEN ‘2007-01-01’ AND ‘2008-01-01’;

a) All employees details between 2007 and 2008


b) All employees details before 2008

c) All employees details from 2007 to 2008

d) None of the mentioned

View Answer

5. Fill the blanks with suitable options?

BETWEEN ______ AND ______

a) Upper and lower limit

b) Lower and upper limit

c) Upper and upper limit

d) None of the mentioned

View Answer

6. What will be the output of the following MySQL statement?

SELECT *

FROM employee

WHERE start_date>=’2007-01-01’ AND

Start_date<=’2005-01-01’

a) All employees between 2007 and 2005

b) All employees from 2007 to 2005

c) Empty set

d) None of the mentioned

View Answer

7. What will be the output of the following MySQL statement?


SELECT customer_id, product_id, avail_balance

FROM account

WHERE avail_balance BETWEEN 3000 AND 5000.

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

d) None of the mentioned

View Answer

8. Which among the following operators is/are belongs to “Inequality conditions”?

a) <>

b) !=

c) =

d) Both <> and !=

View Answer

9. Which among the following operators is/are belongs to “Equality conditions”?

a) <>

b) !=

c) =

d) >/<

View Answer

10. Which among the following operators is/are belongs to “Range conditions”?

a) <>

b) !=

c) =
d) >/<

View Answer

1. Find the error in the following MySQL statement?

SELECT cust_id, fed_id

FROM customer

WHERE cust_id = ’I’

AND fed_id BETWEEN 5000-00-000 AND 9999-999-000;

a) Yes

b) No

c) Range too high to compare

d) None of the mentioned

View Answer

2. What will be the output of the following MySQL statement?

SELECT account_id, product_id, cust_id

FROM account

WHERE product_id IN (‘sav’, ‘chd’, ‘mm’);

a) Only those values are selected whose product_id is either ‘sav’, ‘chd’, ‘mm’

b) Only those values are selected whose product_id is either ‘sav’’

c) Only those values are selected whose product_id is either ‘sav’, ‘chd’

d) All of the mentioned

View Answer

3. What will be the output of the following MySQL statement?


SELECT account_id, product_id, cust_id

FROM account

WHERE product_id NOT IN (‘sav’, ‘chd’, ‘mm’);

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’

d) All of the mentioned

View Answer

4. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.

Intern_id = {1, 2, 3, 4, 5, 6}

Subject = {sql, oop, sql, oop, c, c++}

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 (c, c++);

a) {5, 6}

b) {1, 2, 3}

c) {3, 4}

d) None of the mentioned

View Answer

5. Consider a database name “Sanfoundry” whose attributes are intern_id (primary key), subject.

Intern_id= {1, 2, 3, 4, 5, 6}

Subject= {sql, oop, sql, oop, c, c++}

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 NOT IN (c, c++);

a) {5, 6}

b) {1, 2, 3}

c) {3, 4}

d) None of the mentioned

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 = {sql, oop, sql, oop, c, c++}

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 = 3);

a) {5, 6}

b) {1, 2, 3}

c) {3, 4}

d) None of the mentioned

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 = {sql, oop, sql, oop, c, c++}

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}

Subject = {sql, oop, sql, oop, c, c++}

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 NOT IN (c, c++, oop);

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}

Subject = {sql, oop, sql, oop, c, c++}

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 (c, c++, oop);

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}

Subject = {sql, oop, sql, oop, c, c++}

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 (c, c++, oop, SQL);

a) {5, 6}

b) {1, 2, 3}

c) {3, 4}

d) Empty set
View Answer

1. What will be the output of the following MySQL statement?

SELECT emp_id, fname, lname

FROM employee

WHERE LEFT (lname, 1) =’T’;

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’

c) All of the mentioned

d) None of the mentioned

View Answer

2. What will be the output of the following MySQL statement?

SELECT emp_id, fname, lname

FROM employee

WHERE LEFT (lname, 1) =’F’;

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’

c) All of the mentioned

d) None of the mentioned

View Answer

3. What will be the output of the following MySQL statement?

SELECT emp_id, fname, lname

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’

c) All of the mentioned

d) None of the mentioned

View Answer

4. What will be the output of the following MySQL statement?

SELECT emp_id, fname, lname

FROM employee

WHERE LEFT (fname, 1) =’F’ OR LEFT (lname, 1) =’F’;

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’

d) None of the mentioned

View Answer

5. What will be the output of the following MySQL statement?

SELECT *

FROM employee

WHERE lname LIKE ‘_a%e%’;

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

6. What will be the output of the following MySQL statement?

SELECT *

FROM employee

WHERE lname LIKE ‘F%’ OR lname LIKE ‘%T’;

a) All employees whose last name should started with ‘F’

b) All employees whose last name end with ‘T’

c) All employees whose last name should started with ‘F’ and end with ‘T’

d) None of the mentioned

View Answer

7. What will be the output of the following MySQL statement?

SELECT *

FROM employee

WHERE lname LIKE ‘F%’ AND lname LIKE ‘%T’;

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’

d) None of the mentioned

View Answer

8. What will be the output of the following MySQL statement?


SELECT *

FROM employee

WHERE lname LIKE %bas% OR fname LIKE %bbs%;

a) All employees whose last name should contain substring “bas”

b) All employees whose first name should contain substring “bbs”

c) All employees whose last name should contain substring “bas” or first name should contain
substring “bbs”

d) None of the mentioned

View Answer

9. What will be the output of the following MySQL statement?

SELECT *

FROM employee

WHERE lname LIKE %t%f%n%;

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

d) All of the mentioned

View Answer

1. What is the meaning of “NULL” in Mysql?

a) Not applicable

b) Value not yet known

c) Value undefined

d) All of the mentioned

View Answer

2. Is the following statement is true/false?


“An expression can be NULL, but can never equal to NULL”

a) True

b) False

View Answer

3. Is the following statement is true/false?

“Two NULL values are equal to each other”

a) True

b) False

View Answer

4. Which operator is used to check whether the expression is “NULL”?

a) IS NULL

b) NOT NULL

c) ON

d) None of the mentioned

View Answer

5. Which operator is used to check the expression is not “NULL”?

a) IS NULL

b) NOT NULL

c) ON

d) None of the mentioned

View Answer

6. What will be the output of the following MySQL command?


SELECT *

FROM person

WHERE emp_id IS NULL;

a) Only those columns whose emp_id is NULL

b) Only those columns whose emp_id is not NULL

c) No output

d) None of the mentioned

View Answer

7. What will be the output of the following MySQL command?

SELECT *

FROM person

WHERE emp_id IS NULL;

a) Only those columns whose emp_id is NULL

b) Only those columns whose emp_id is not NULL

c) No output

d) None of the mentioned

View Answer

8. What will be the output of the following MySQL command?

SELECT *

FROM person

WHERE emp_id = NULL;

a) Only those columns whose emp_id is NULL

b) Only those columns whose emp_id is not NULL


c) No output

d) None of the mentioned

View Answer

9. What will be the output of the following MySQL command?

SELECT fname

FROM person

WHERE emp_id != 6;

a) Only those names whose emp_id is not equal to 6

b) Only those names whose emp_id is equal to 6

c) No output

d) None of the mentioned

View Answer

10. What will be the output of the following MySQL command?

SELECT fname

FROM person

WHERE emp_id != 6 OR emp_id IS NULL;

a) Only those names whose emp_id is not equal to 6 or emp_id with NULL values

b) Only those names whose emp_id is not equal to 6

c) Only those names whose emp_id is equal to 6

d) None of the mentioned

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

10: Which of the following can add a row to a table?

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

B. DELETE XXX WHERE confirm = “YES”

C. DROP XXX WHERE confirm = “YES”

D. DROP TABLE XXX

E. DELETE XXX

F. DELETE TABLE XXX

Ans: D

12: The USE command

A. Is a pseudonym for the SELECT command

B. Has been deprecated and should be avoided for security reasons


C. Should be used to choose the database you want to use once you’ve connected to MySQL

D. Is used to load code from another file

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}$

D. LIKE …… (that’s six dots)

E. LIKE ______ (that’s six underscore characters)

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 )

C. CONCAT( “A” , “B” )

D. CONCAT ( “A” , “B” )

E. CONCAT (A, B)

F. CONCAT (“A”, “B”)

Ans: C

25: In a LIKE clause, you can ask for any 6 letter value by writing:

A. LIKE ______ (that’s six underscore characters)

B. LIKE .{6}

C. LIKE ??????

D. LIKE ^.{6}$

E. LIKE …… (that’s six dots)

Ans: A

31: Which of these is not a valid name for a column


A. To

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

d) None of the above

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

d) None of the above

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

B. DELETE XXX WHERE confirm = “YES”

C. DROP XXX WHERE confirm = “YES”

D. DROP TABLE XXX

E. DELETE XXX

F. DELETE TABLE XXX

Ans: D

45. Which statement is used to count number of rows in table?

A. SELECT COUNT(*) FROM table_name;

B. SELECT COUNT ALL(*) FROM table_name;

C. SELECT ROWS(*) FROM table_name;

D. All the above

Answer : A

47. Which clause is used to sort the result of SELECT statement?


A. SORT BY

B. ORDER BY

C. ARRENGE BY

D. None of the above

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

The value of Primary key

can be duplicated

can be null

cannot be null

none of these

Drop table structure is

DML Statement

DDL Statement

Query Statement

None of the above

Show Answer

Added By : Tushar

Like (1)

In SQL, __________ is an Aggregate function.

SELECT

CREATE
AVG

MODIFY

Show Answer

Added By : Mahesh

The primary key is selected from the:

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 ?

DML(Data Manipulation Langauge)

DDL(Data Definition Langauge)

Query

Relational Schema

Show Answer

Added By : Prachi Gupta

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

The term attribute refers to a ___________ of a table.

Record

Column

Tuple

Key

Show Answer

Added By : Prachi Gupta

Like (1)

The number of attributes in relation is called as its

Cardinality

Entity

Tuples

Degree

Show Answer

Added By : Prachi Gupta

Like (1)

Which of the following is used to delete an entire MYSQL database?

drop entiredb dbname

drop database dbname

drop db dbname

drop dbase dbname


Show Answer

Added By : Prachi Gupta

Like (0)

Drop Table cannot be used to drop a table referenced by a ______________ constraint.

Primary Key

Sub Key

Super Key

Foreign Key

Show Answer

Added By : Rahul

In an RDBMS relationship between tables are created by using

Alternate Keys

Foreign Keys

Candidate Keys

Composite Keys

Show Answer

Added By : Kiran Kumar

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

DDL is used for _______?

Manage the changes made by DML statements

Defining database schema


Control access to data stored in a database

None of the above

Show Answer Show Explanation

Added By : Amitosh

Like (2)

DML is used for _______?

Control access to data stored in a database

Defining database schema

Inserting, Deleting and Updating data

None of the above

Show Answer Show Explanation

Added By : Amitosh

Which is right statement to insert multiple records?

INSERT INTO job_question VALUES ('col1', 'col2'), ('col1', 'col2'), ...

INSERT INTO job_question VALUES ('col1', 'col2'), VALUES ('col1', 'col2'), ...

A and B Both

None of the above

Show Answer

Added By : Akash

The DISTINCT keyword used along with the SELECT keyword retrieves ______ ?

Duplicate data depending on the column list

Unique data depending on the column list

Sorted data depending on the column list

None of the above

Show Answer Show Explanation

Added By : Rajat

Like (5)
Which clause is used to sort the result of SELECT statement?

SORT BY

ORDER BY

ARRENGE BY

None of the above

Which statement is used to count number of rows in table?

SELECT COUNT(*) FROM placement_question;

SELECT COUNT ALL(*) FROM placement_question;

SELECT ROWS(*) FROM placement_question;

All the above

Which statement is used to find out what databases currently exist on the server?

SHOW DATABASE

SHOW DATABASES

SHOW ALL DATABASES

All the above

You might also like