Skip to main content

Posts

Showing posts with the label select queries

SQL Queries from Multiple tables and Questions

Question -Employee_Details EmpID NVARCHAR(10) Emp_FirstName NVARCHAR(100) Emp_LastName NVARCHAR(100) DateOfJoining Datetime Employee_Salary EmpID NVARCHAR(10) Refers to Employee Details PayPeriodId INT Refers to Master_PayPeriod SalaryAmount Money DateofSalaryCreditedtoAccount Datetime Master_PayPeriod PayPeriodID INT PayMonthYear Datetime Employee Details Sample Data 000001 ABC XYZ 01-Jan-2000 000002 Rahul Y 13-Dec-2000 000003 Amit S 12-Apr-2000 000004 Shobit K 01-Jan-2000 000005 Harshit J 13-Dec-20

Important SQL Questions for Exam Preparation

1. Which of the following queries can you use to search for employees with the pattern 'A_B' in their names? A. SELECT last_name FROM employees WHERE last_name LIKE '%A\_B%' ESCAPE '\\'; B. SELECT last_name FROM employees WHERE last_name LIKE '%A_B%' ESCAPE; C. SELECT last_name FROM employees WHERE last_name LIKE 'A_B%' ESCAPE '%'; D. SELECT last_name FROM employees WHERE last_name LIKE '%A\_B%' ESCAPE '\'; 2. The number of records in a table emp is given by statement A. Select total(*) from emp; B. Select count(*) from emp; C. Select sum(*) from emp; D. Select total from emp; 3. Write a query to Display the Name and studentid of all Students of branch CSE and ECE in alphabetical order by name. 4. Can you use the SQL JOIN and SQL HAVING clauses in one SQL statement? A .Yes. B . No. C . It depends. D . Don't know 5. # Which four are valid Oracle constraint types? A.