0% found this document useful (0 votes)
12 views

MYSQL Associate - Final

Uploaded by

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

MYSQL Associate - Final

Uploaded by

bhondemansi14
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Q1- What can be done to reduce the time spend on deleting all the rows from the table?

Ans- Use TRUNCATE option

Q2- Which of the below query will help to remove and index INDX_CAND from CAND_TABLE?

Ans- DROP INDEX INDX_CAND ON 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)………

Ans- Chais chang

Q4- What is expected Output of below SQL SELECT EmpNo FROM emp e WHERE EXISTS (SELECT
FROM dept d where e.deptno = d.deptno);……….

Ans- Selects following records EmpNo ---------- 103

Q5- Which of the parameter types does a stored procedure support?

Ans- IN, OUT, INOUT

Q6-Which of the below lines are not commented: /* Select all the columns of all the records in the
Customer table*/ SELECT * FROM Customer……………..

Ans- Line 2 only

Q7- What will be the output of below query: SELECT REVERSE(‘SQL Tutorial’)

Ans- lairotuT LQS

Q8- Consider the below view query: CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM
CUSTOMERS WHERE age is NOT NULL WITH CHECK OPTION………….

Ans- Name and Age of Customers whose Age is NOT NULL

Q9- Which command can be used to take backup of USERCOPY table from a database?

Ans- mysqldump -u -p –tables USERCOPY>USERCOPY.sql


Q10- Which of the following statements are true about implicit and explicit cursor?

Ans- Only Explicit cursors need to be declared by the user.

Q11- Below join query depicts which join: SELECT column-name(s) FROM table T1, table1 T2 where
condition;

Ans- SELF JOIN

Q12- Which of the delete option uses fewer resources and is faster?

Ans- TRUNCATE

Q13- MyISAM is a

Ans- Storage Engine provided by MySQL database

Q14- The number of partitions required can be explicitly mentioned in which of the below
mentioned partition types?

Ans- RANGE, LIST

Q15- Consider the below procedure: CREATE PROCEDURE InsertSupplierProduct(IN inSupplierID INT,
IN inProductId INT ) BEGIN—exit if………….

Ans- Both a & b

Q16- The ‘REPLACE’ command syntax is as below

Ans- Either a or b

Q17- Consider the below view query: CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM
CUSTOMER…

Ans- Name and Age of Customers whose Age is NOT NULL

Q18- Which of the below option enable faster record deletion.

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?

Ans- Both b & c

Q21- Which among the following is the right syntax for creating a view?

Ans- CREATE VIEW Brazil_Customers AS SELECT CustomerName, ContactName FROM Customers


WHERE Country = “Brazil”;

Q22- What are the DML statements that can be executed on a View?

Ans- Insert, Update and Delete

Q23- Which command can be used to take backup of USERCOPY table from a database?

Ans- mysqldump -u -p –tables USERCOPY > USERCOPY.sql (c)

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….

Ans- Option A and D

Q25- Which among the following are activities involved in implementing Business Logic?

Ans- Both a & b

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

Ans- Total number of rows deleted and inserted

Q28- Which of the below statements are true about Stored Procedures?

Ans- Only a & c


Q29- 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

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

Ans- Straight 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?

Ans- use TRUNCATE option

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…..

Ans- Both a and b

Q39- What is purpose CONNECT BY in following Query? SELECT LPAD(‘ ’, 4*(LEVEL-1))….

Ans- Create hierarchical queries for employee

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……..

a) 10, 75, 64, 43, 60, 57, 55


b) 90, 12, 68, 34, 62, 45, 55
c) 9, 85, 47, 68, 43, 57, 55
d) 79, 14, 72, 56, 16, 53, 55

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…..

Ans- Option B, C and D

Q44- How to Grant read/write permissions to a user George on Purview table?

Ans- GRANT ALL ON PURVIEW TO GEORGE

Q45- Consider the below CANDIDATE table columns, 1. CANDIDATE_ID INT(11) …..most for creating
a partition?

Ans- CANDIDATE_ID, JOINING_DATE, DEPARTMENT_ID

Q46- Which of the below statements is/are correct?


Ans- Both a&b

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

Q49- What are the steps involved in using a cursor?

Ans- DELCARE, OPEN, FETCH, CLOSE

Q50- How to recover from the scenario of inserting duplicate values into a primary key……

Ans- Option A, B and C

Q51- Which of the below update command modifies the phone number of the ‘Jack’ in the
Candidate table?

Ans- UPDATE Candidate SET Phone = ‘9867458798’ WHERE Name =’Jack’;

Q52- Data can be injected into a table using below methods of insert command

Ans- Any of the above

Q53- Which of the below statement about storage engine is true?

Ans- InnoDB provides both Foreign Key and Transaction support

Q54- Which query can be used for displaying stored procedure errors?

Ans- SHOW 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- create index customer_index on customer_info(phone)


Q56- In the EMPLOYEE table EMP_ID column is reffered as HOD_ID column the DEPARTMENT table…

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

Q58- The SELECT statement is parsed in the following order

Ans- FROM ,WHERE,GROUP BY,HAVING,SELECT,ORDERBY

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

Ans- LIST Partitioning

Q61- What is expected output of below SQL SELECT STUFF(‘SQL Tutorial,1,3,’HTML’’)?

Ans- HTM Tutorial.

Q62- Which delete command will be used to delete all the values of a particular record?

Ans- DELETE FROM [table_name] where [field_name]=[Value];

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?

Ans- Both a and b

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’.

Q68- Is the following index a good fit for query?............

Ans- Good fit: No need to Change.

Q69- 1. CREATE PROCEDURE UPDATE_PROFILE 2.(V_PHONE, V_EMAIL………………..

Ans- Line: 5,9 and 11.

Q70- Which of the following statement is FALSE with respect to views?

Ans- A view can be accessed even though the table from which it is created is dropped.

Q71- 1. CREATE FUNCTION no_of_years(IN date1 date) 2. RETURNS int DETERMINISTIC………..

Ans- Line 1,3 and 5.

Q72- To maintain performance of tables having variables length rows, which statement is used?

Ans- Optimize table

Q73- The default index type for MEMORY tables is ____

Ans- Hash

Q74- Which of the below would update data in table?

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?

Ans- Both a & b

Q76- The number of rows affected by the REPLACE query indicates

Ans- The number of matching rows replaced in the table

Q77- What will be the result of below query: Select RAND();

Ans- Number between 0 and 1

Q78- What will happen if the below insert statement is executed twice where id is the primary key?

INSERT INTO Candidate_Table (id, Name, Dept, Branch) VALUES(1,’Candy’,1000,2)

Ans- One row will be inserted with error message

Q79- Which among the following are valid backup types in MySQL?

Ans- Both a & b

Q80- Transactional procedures include which of the below keywords?

Ans- Begin transaction, Commit, Rollback

Q81- Which query can be used to Delete the column ‘Birthday’ from the Person table?

Ans- ALTER TABLE Persons DROP COLUMN Birthday;

Q82- Foreign key constraint of column(s) should be implemented

Ans- Either at column level or table level during table creation

Q83- Which of the below would Update data in table

Ans- Update[table name] SET Select_priv=’Y’, Insert_priv=’Y’, Update_priv=’Y’ where [field name]=
‘user’;

Q84- Which of these are the right syntaxes of a View

Ans- Both a & b


Q85- If the REPLACE query contains a duplicate value of primary key

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…

Ans- One row will be selected where id is 1

Q92- Which of the following WHERE clauses is faster?

Ans- WHERE col 9/3

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?

Ans- mysql -u user1 -p

Q95- MySQL query add Primary Key constraint to an existing ‘ID’ column of ‘userform’ table is?

Ans- ALTER TABLE Userform ADD CONSTRAINT User_PKEY PRIMARY KEY(ID)

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy