SQL
GATE CSE & IT · Database Management Systems - SQL · 1998-2025
Study anchor
Source-book anchor pending for this concept.
Practice action
Start latest PYQPYQs in this concept
All concepts →Consider the following relational schema: Students (rollno: integer, name: string, age: integer, cgpa: real) Courses (courseno: integer, cname: string, credits: integer) Enrolled (...
Consider the following database tables of a sports league. player (pid,pname, age) coach (cid,cname) team (tid, tname,city,cid) members (pid, tid) An instance of the table and an S...
Consider the following relational schema: Students ($$\mathrm{\underline {rollno:integer}}$$, name: string, age: integer, cgpa: real) Courses ($$\mathrm{\underline {courseno:intege...
Consider the following table named Student in a relational database. The primary key of this table is rollNum. Student rollNum name gender marks 1 Naman M 62 2 Aliya F 70 3 Aliya F...
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is a...
Consider the following two tables and four queries in SQL. Book ( isbn , bname), Stock ( isbn , copies) Query 1: SELECT B.isbn, S.copies FROM Book B INNER JOIN Stock S ON B.isbn =...
Consider the following database table named $$water$$_$$schemes :$$ water_schemes scheme_no district_name capacity 1 Ajmer 20 1 Bikaner 10 2 Bikaner 10 3 Bikaner 20 1 Churu 10 2 Ch...
Consider the following relation: Student Roll_No Student_Name 1 Raj 2 Rohit 3 Raj Performance Roll_No Course Marks 1 Math 80 1 English 70 2 Math 75 3 English 80 2 Physics 65 3 Math...
Consider the following relation $$\,\,\,\,\,\,\,\,$$ Cinema(theater, address, capacity) Which of the following options will be needed at the end of the $$SQL$$ query $$\,\,\,\,\,\,...
SELECT operation in SQL is equivalent to
Given the following statements: S1: A foreign key declaration can always be replaced by an equivalent check assertion in SQL. S2: Given the table R(a,b,c) where a and b together fo...
Consider the following relational schema: employee ( empId, empName, empDept ) customer ( custId, custName, salesRepId, rating) SalesRepId is a foreign key referring to empId of th...
Given the following schema: employees(emp-id, first-name, last-name, hire-date, dept-id, salary) departments(dept-id, dept-name, manager-id, location-id) You want to display the la...
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same an...
Consider the following relational schema. Students( rollno: integer, sname: string) Courses( courseno: integer, cname: string) Registration( rollno: integer, courseno: integer, per...
Database table by name Loan_Records is given below. Borrower Bank_Manager Loan_Amount Ramesh Sunderajan 10000.00 Suresh Ramgopal 5000.00 Mahesh Sunderajan 7000.00 What is the outpu...
Consider a database table T containing two columns X and Y each of type integer. After the creation of the table, one record (X = 1, Y = 1) is inserted in the table. Let MX and MY...
A relational schema for a train reservation database is given below: Passenger ( pid, pname, age) Reservation (pid, cass, tid) Table: Passenger pid pname age 0 'Sachin' 65 1 'Rahul...
Consider The Following Relational Scheme Student ( school-id, sch-roll-no , sname, saddress) School ( school-id , sch-name, sch-address, sch-phone) Enrolment ( school-id, sch-roll-...
Consider the table employee(empId, name, department, salary) and the two queries Q 1 , Q 2 below. Assuming that department 5 has more than one employee, and we want to find the emp...
Consider the relation account (customer, balance) where customer is a primary key and there are no null values. We would like to rank customers according to decreasing balance. The...
Consider the relation "enrolled (student, course)" in which (student, course) is the primary key, and the relation "paid (student, amount)" where student is the primary key. Assume...
Consider a database with three relation instances shown below. The primary keys for the Drivers and Cars relation are Did and cid respectively and the records are stored in ascendi...
A table ‘student’ with schema (roll, name, hostel, marks), and another table ‘hobby’ with schema (roll, hobbyname) contains records as shown below: Table: student Roll Name Hostel...
The relation book (title, price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list? Select t...
In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold...
A relational database contains two table student and department in which student table has columns roll_no, name and dept_id and department table has columns dept_id and detp_name...
Consider two tables in a relational database with columns and rows as follows: Table: Student Roll_no Name Dept_id 1 ABC 1 2 DEF 1 3 GHI 2 4 JKL 3 Table: Department Dept_id Dept_na...
The employee information in a company is stored in the relation Employee (name, sex, salary, deptName) Consider the following SQL query Select deptName From Employee Where sex = ‘M...
Consider the following SQL query: Select distinct a 1 , a 2 , ..., a n From r 1 , r 2 , ..., r m Where P; For an arbitrary predicate P, this query is equivalent to which of the fol...
Consider the set of relations shown below and the SQL query that follows. Students: (Roll_number, Name, Date_of_birth) Courses: (Course number, Course_name, Instructor) Grades: (Ro...
In SQL, relations can contain null values, and comparisons with null values are treated as unknown. Suppose all comparisons with a null value are treated as false. Which of the fol...
Given relations r( w, x ) and s( y, z ), the result of select distinct w,x from r, s; is guaranteed to be same as r, provided
Consider the set of relations EMP (Employee-no, Dept-no, Employee-name, Salary) DEPT (Dept-no, Dept-name, Location) Write an SQL query to: (a) Find all employee names who work in d...
Which of the following is/are correct?
Suppose we have a database consisting of the following three relations. FREQUENTS (student, parlor) giving the parlors each student visits. SERVES (parlor, ice-cream) indicating wh...