MYSQL Associate - Final
MYSQL Associate - Final
Q2- Which of the below query will help to remove and index INDX_CAND from CAND_TABLE?
Q3- What is expected Output of Below SQL SELECT ProductName FROM Products WHERE ProductID=
ALL (SELECT ProductId FROM OrderDetails WHERE Quantity = 3 OR Quantity =2)………
Q4- What is expected Output of below SQL SELECT EmpNo FROM emp e WHERE EXISTS (SELECT
FROM dept d where e.deptno = d.deptno);……….
Q6-Which of the below lines are not commented: /* Select all the columns of all the records in the
Customer table*/ SELECT * FROM Customer……………..
Q7- What will be the output of below query: SELECT REVERSE(‘SQL Tutorial’)
Q8- Consider the below view query: CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM
CUSTOMERS WHERE age is NOT NULL WITH CHECK OPTION………….
Q9- Which command can be used to take backup of USERCOPY table from a database?
Q11- Below join query depicts which join: SELECT column-name(s) FROM table T1, table1 T2 where
condition;
Q12- Which of the delete option uses fewer resources and is faster?
Ans- TRUNCATE
Q13- MyISAM is a
Q14- The number of partitions required can be explicitly mentioned in which of the below
mentioned partition types?
Q15- Consider the below procedure: CREATE PROCEDURE InsertSupplierProduct(IN inSupplierID INT,
IN inProductId INT ) BEGIN—exit if………….
Ans- Either a or b
Q17- Consider the below view query: CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM
CUSTOMER…
Ans- TRUNCATE
Q19- Which is more efficient to insert data into a table? LOAD DATA or INSERT?
Ans- Load Data
Q20- Which of the below statements is/are true about USER variables in Mysql?
Q21- Which among the following is the right syntax for creating a view?
Q22- What are the DML statements that can be executed on a View?
Q23- Which command can be used to take backup of USERCOPY table from a database?
Q24- The ‘REPLACE’ command helps us to A. insert a new record…. B. Updates only the duplicate
column values to new….. C. Only to replace the existing records…….. D. Replace the existing
records with new records….
Q25- Which among the following are activities involved in implementing Business Logic?
Q26- What will be the outcome of below query? DELETE FROM Cand_Table WHERE Name=’Jack’
LIMIT 5
Ans- Deletes only first 5 rows from Cand_Table where Name is Jack
Q27- The REPLACE statement returns the number of rows affected to indicate the
Q28- Which of the below statements are true about Stored Procedures?
Ans- innoDB performs row level locking whereas MyISAM does table level locking
Q30- Which partitioning would suit for quickly querying the employees based on their number of
years in the organisation?
Ans- Error statement gets ignored and values gets inserted into the table
Q31- Which statement is used to force the optimizer to use table in a particular order? A) FORCE
INDEX B) USE INDEX C) IGNORE INXED D) STRAIGTH_JOIN
Q32- Which partitioningsuppos option would provide an equal distribution of data among
predefined number of partitions?
Ans- HASH
Q33- What can be done to reduce the time spend on deleting all the rows from the table?
Q34- Which partitioning would suit for quickly querying the employees based on their number of
years in the organization?
Ans- HASH
Q35- Which is the following statements are same? A. SELECT LNAME FROM EMP WHERE EMPNO =
12; B. SELECT lname FROM emp WHERE empno = 12; C. SELECT lname FROM emp WHERE empno =
:id; D. SELECT lname FROM emp WHERE empno = 12;
Ans- B and D.
Q36- The SELECT command forces the tables to be used in an order in which its mentioned in the
FROM clause. The option used for that is
Ans- HIGH_PRIORITY
Q37- Consider a table Candidate (Id INT, VARCHAR(25)). It is found that the record of Jack repeats in
the table. Which of the below query is used to delete and retain only in record? ========
Ans- DELETE FROM Candidate WHERE id NOT IN (SELECT DISTINCT Id FROM Candidate);
Q38- Consider the below function: CREATE FUNCTION FindSiteID (name_in VARCHAR(50)) RETURNS
INT BEGIN DECLARE done INT DEFAULT FALSE; DECLARE…..
Q40- Which among the following statement about locking granularity of storage engines is correct?
Ans- innoDB performs row level locking whereas MyISAM does table level locking
Q41- Indexing is useful for fast searching and B-tree is used for indexing in a database. Instead of B-
tree. Binary Search Tree is used……..
Ans- c
Q42- Which of the below type of partition uses primary key as the partitioning column by default.
Ans- KEY
Q43- Identify the correct MySQL command(s) to insert a new record into table having 3 columns…..
Q45- Consider the below CANDIDATE table columns, 1. CANDIDATE_ID INT(11) …..most for creating
a partition?
Q47- Which of the below statements possibly set the engine for a table? A. CREATE TABLE…..
Ans- Options A, B, C
Q48- Which of the below statement is true about MyiSAM/InnoDB storage engine(s)?
Ans- Only InnoDB provides both foreign key and transactional support
Q50- How to recover from the scenario of inserting duplicate values into a primary key……
Q51- Which of the below update command modifies the phone number of the ‘Jack’ in the
Candidate table?
Q52- Data can be injected into a table using below methods of insert command
Q54- Which query can be used for displaying stored procedure errors?
Q55- Select the index that should be created in CUSTOMER_INFO table to improve the performance
of the below query: SELECT name, address FROM CUSTOMER_INFO WHERE phone = 72…..
Ans- EMP_ID value will not be deleted as it is referred by values as HOD_ID column.
Q-57- What is expected output of below SQL SELECT DeptNo FROM dept_tbi UNION ALL SELECT
DeptNo FROM dept_master; Table : Dept_tbl DeptNo DepartName……
Ans-DeptNo---------10 10 20 20 30 30 40 50
Q59- What is expected output of below SQL SELECT DeptNo FROM dept_tbi dt LEFT OUTER JOIN….
Ans- DeptNo-------- 10 20 30 50
Q60- In an employee table, partitioning the values based on the specific set of departments can be
achieved using
Q62- Which delete command will be used to delete all the values of a particular record?
Q63- Consider a table DEPT(DEPTID INT, DNAME VARCHAR(25), LOCATION VARCHAR(25)) having few
records in it.
Ans- Error
Q64- What are the Options that are available in insert Query of MySQL?
Q65- CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM CUSTOMERS WHERE age IS NOT
NULL
Ans- Name and age of the customers,if their age is specified in the CUSTOMERS table.
Q66- The below query fails due to some error in the statement, identify the clause which contains
the error………..
Ans-LIMIT 5,3.
Q67- How does the below command impact the records from Candidate table? DELETE FROM
Candidate WHERE Name = ‘Jack’ LIMIT 5;
Ans- Delete first matching rows from Candidate table with name as ‘Jack’.
Ans- A view can be accessed even though the table from which it is created is dropped.
Q72- To maintain performance of tables having variables length rows, which statement is used?
Ans- Hash
Ans- Update[table name] SET Select_priv=’Y’, Insert_priv=’Y’, Update_priv=’Y’ where [field name]=
‘user’;
Q75- Which of these are right syntaxes of a View?
Q78- What will happen if the below insert statement is executed twice where id is the primary key?
Q79- Which among the following are valid backup types in MySQL?
Q81- Which query can be used to Delete the column ‘Birthday’ from the Person table?
Ans- Update[table name] SET Select_priv=’Y’, Insert_priv=’Y’, Update_priv=’Y’ where [field name]=
‘user’;
Ans- The entire duplicate record in the table gets replaced with the new record given in the REPLACE
query
Q86- Which partitioning option would provide an equal distribution or data among predefined
number of partitions?
Ans- HASH
Q87- Suppose table tbl_1 has 8 rows and table tbl_2 has 6 rows, the numbers of combinations
through which…………..
Ans- 48
Q88- If a column contains 7 values and 6 distinct values, the cardinality is___
Ans- 6
Q89- Consider the table, DEPT(DEPTID INT, DNAME VARCHAR(25), LOCATION VARCHAR(25)). What
will be the output of the following query for this table. SELECT SUM(LOCATION) FROM DEPT;
Ans- 0
Q90- What will happen if the below Insert statement is executed twice where id is the primary key?
INSERT IGNORE INTO Candidate_Table (id, Name, Dept, Branch) VALUES(1,’Candy’,1000,2);
Ans- Error statement gets ignored and values gets inserted into the table
Q91- Consider a table Candidate(Id INT, Name VARCHAR) with the below mentioned data…
Q93- Which of the below delete options is efficient and safe for record deletion
Ans- TRUNCATE
Q94- Which of the below commands can be used to connect to MYSQL?
Q95- MySQL query add Primary Key constraint to an existing ‘ID’ column of ‘userform’ table is?
Q96-Identify the error clause in below query: SELECT YEAR(OrderDate) as OrderYear from purchase
WHERE OrderYear = 2016;
Ans- where
Q.97-A table Employee has a column named Salary.Query 1 is run on Employee table.
Ans: T2>T1