Gate 2005

Duration: 5 min

This video lesson is available to enrolled students.

Return to /learn/RPSC-PROGRAMMER/paper-1-dbms/sql/nested-correlated-subqueries/asset-gate-2005-3439 after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Paper 1 | Reasoning Test: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Syllogisms, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Seating Arrangements, Blood Relations, Puzzle Solving (Puzzles), Venn Diagram, Analogy, Ranking, Order and Sequence, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Selection Decision Table (Decision Making), Logical Sequence Of Words, Cubes & Dices, Analytical Reasoning (Counting Figures Reasoning), Calendar, Alphabet and Word Tests, Numerical Reasoning, Number System, Averages, Mixtures and Alligation, Percentages, Series Completion, Analogy and Classification, Patterns in Two-Dimensional Figures, Coding and Decoding, Mathematical Operations, Direction Sense, Algebra, Logical Deduction and Induction, Syllogisms and Venn Diagrams, Critical Reasoning, Order, Ranking and Sequence, Reading Comprehension, Profit, Loss and Discount, Constraint Puzzles, Speed, Time and Distance, Traverse Surveying, Ratio and Proportion, Time and Work, Mensuration, Permutations and Combinations, Clocks and Calendars, Data Interpretation, Assembling and Grouping of Shapes, Transformation of Shapes, Three-Dimensional Patterns and Visualization, Cubes and Dice, Vocabulary, Blood Relations, Data Sufficiency
  2. Paper 1 | Numerical Analysis: Number System, HCF LCM, Percentage, Ratio and Proportion (Ratios), Average, Sequence and Series (Series), Powers and Exponents (Surds and Indices), Algebra, Statistics, Data Interpretation, Mental Ability, Arithmetic, Logarithm, Profit and Loss, Simple Interest and Compound Interest, Speed Time and Distance, Mixture and Alligation, Mensuration and Geometry, Permutation and Combination, Probability, Sequences and Series, Powers, Surds and Logarithms, Subject-Verb Agreement, Sentence Completion, Geometry, Sentence Structure and Correction, Data Sufficiency, Trigonometry, Measurement and Quantity Take-Off, Signal Space and Optimum Detection, Probability, Statistics, Algebra, Time and Work, Speed, Time and Distance, Data Interpretation, Graph Theory, Combinatorics
  3. Paper 1 | General Knowledge: State Wise GK, History, Geography, GK- Current Affairs, Static General Knowledge, Polity, Indian Economy
  4. Paper 1 | DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, SQL, Transaction Management, Concurrency Control, Relational Calculus, Database Security & Authorization, Database Recovery
  5. Paper 1 | Data Communication & Network: Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Network Security, Security in Mobile and Wireless Computing, Input Output Organisation, File Management, Hardware Basics, Terms & Abbreviations, Protocols & Services, Network Access Technologies, Cyber Safety and Security, Basics of COA
  6. Paper 2 | System Analysis & Design: Fundamentals of Systems and Information Systems, SDLC and Development Approaches, Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Documentation and Software Requirements Specification (SRS), SDD and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management, Security, Risk Management & Maintenance, extras
  7. Paper 2 | Programming Language (Java): Java Fundamentals, OOPS with Java, Array, String, IO & References, Generic & Collections, Multithreading, Java, Miscellaneous, Control Flow, OOPS with C++, Stack, C Fundamentals, Arrays & Pointers, Object Oriented Technology, Control Flow & Looping, Introduction to Python
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

The video presents a detailed analysis of a SQL query problem from the GATE 2005 exam. The problem involves a relation named `book` with attributes `title` and `price`. The core of the lesson is interpreting a nested SQL query that selects titles based on a condition involving a subquery. The instructor explains that the subquery counts the number of books in the relation that have a price strictly greater than the price of the book currently being processed in the outer query. To make this concept clear, he draws two tables representing the outer alias `B` and the inner alias `T`. He populates these tables with a sequence of prices (10, 20, 30, 40, 50, 60, 70) to simulate the database state. This visual aid helps in tracing the execution of the query for each row.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The instructor begins by displaying the problem statement and the SQL code on the screen. He reads the query aloud, highlighting the outer query `select title from book as B` and the correlated subquery. He explains that for every row in the outer table `B`, the subquery runs to count rows in table `T` where `T.price > B.price`. To illustrate this, he draws two vertical tables on the whiteboard. He labels them `B` and `T` and starts writing down sample price values like 10, 20, 30, 40, 50, 60, and 70 in both tables. This setup is intended to create a concrete scenario to test the logic of the query.

  2. 2:00 – 4:38 02:00-04:38

    With the tables drawn, the instructor proceeds to calculate the count for each price in the outer table. He explains that for the book with price 70, there are zero books with a higher price, so the count is 0. For price 60, the count is 1 (only 70 is higher). He continues this pattern, showing that for prices 50, 40, and 30, the counts are 2, 3, and 4 respectively. Since the condition is `count < 5`, all these books satisfy the condition. He notes that for price 20, the count is 5, which fails the condition. Thus, the query returns the titles of the books with prices 70, 60, 50, 40, and 30. He identifies this set as the five most expensive books and selects option (D) as the correct answer, eliminating options suggesting four books or the fifth most inexpensive book.

The lecture demonstrates a powerful technique for understanding correlated subqueries: using a small, ordered dataset to trace execution. By manually calculating the count of more expensive books for each price point, the instructor proves that the query filters for the top 5 most expensive items. This step-by-step breakdown transforms an abstract SQL statement into a logical ranking problem, making it easier for students to grasp how the `count(*)` function interacts with the `where` clause in a nested context.

Loading lesson…