C05A-2019S – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Q&A CBSE12A-2019-C05A #7074 siteicon  

Question:

Write SQL queries for (i) to (iv) and write outputs for SQL queries (v) to (viii), which are based on the table given below:

Table: TRAINS

TNO TNAME START END
11096 Ahimsa Express Pune Junction Ahmedabad Junction
12015 Ajmer Shatabdi New Delhi Ajmer Junction
1651 Pune Hbj Special Pune Junction Habibganj
13005 Amritsar Mail Howrah Junction Amritsar Junction
12002 Bhopal Shatabdi New Delhi Habibganj
12417 Prayag Raj Express Allahabad Junction New Delhi
14673 Shaheed Express Jaynagar Amritsar Junction
12314 Sealdah Rajdhani New Delhi Sealdah
12498 Shane Punjab Amritsar Junction New Delhi
12451 Shram Shakti Express Kanpur Central New Delhi
12030 Swarna Shatabdi Amritsar Junction New Delhi

Table:PASSENGERS

PNR TNO PNAME GENDER AGE TRAVELDATE
P001 13005 R N AGRAWAL MALE 45 2018-12-25
P002 12015 P TIWARY MALE 28 2018-11-10
P003 12015 S TIWARY FEMALE 22 2018-11-10
P004 12030 S K SAXENA MALE 42 2018-10-12
P005 12030 S SAXENA FEMALE 35 2018-10-12
P006 12030 P SAXENA FEMALE 12 2018-10-12
P007 13005 N S SINGH MALE 52 2018-05-09
P008 12030 J K SHARMA MALE 65 2018-05-09
P009 12030 R SHARMA FEMALE 58 2018-05-09

(i)  To display details of all Trains which Start from New Delhi.

(ii) To display the PNR, PNAME, GENDER and AGE of all Passengers whose AGE is below 50.

(iii) To display total number of MALE and FEMALE Passengers.

(iv) To display details of all Passengers travelling in Trains whose TNO is 12015.

(v) SELECT MAX (TRAVELDATE), MIN(TRAVELDATE) FROM PASSENGERS WHERE GENDER = ‘FEMALE’;

(vi) SELECT END, COUNT(*) FROM TRAINS GROUP BY END HAVING COUNT(*)>1;

(vii) SELECT DISTINCT TRAVELDATE FROM PASSENGERS;

(viii) SELECT TNAME, PNAME FROM TRAINS T, PASSENGERS P WHERE T.TNO=P.TNO AND AGE BETWEEN 50 AND 60;

Answer:

i) SELECT * FROM TRAINS WHERE START=”New Delhi”;

ii) SELECT PNR, PNAME, GENDER, AGE FROM PASSENGERS WHERE AGE < 50;

iii) SELECT GENDER, COUNT(GENDER) FROM PASSENGERS GROUP BY GENDER;

iv) SELECT * FROM PASSENGERS WHERE TNO=12015;

v)
MAX(TRAVELDATE) MIN(TRAVELDATE)
2018-11-10                     2018-05-09

vi)

END                         COUNT(*)
Habibganj               2
Amritsar Junction 2
New Delhi               4

vii)

DISTINCT TRAVELDATE
2018-12-25
2018-11-10
2018-10-12
2018-05-09

viii)

TNAME                             PNAME
Amritsar Mail                  N S SINGH
Swarna Shatabdi            R SHARMA


Share

CSKC| Created: 10-Apr-2019 | Updated: 2-Apr-2020|CBSE12A-2019






×
ssignment Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning 2D Array Memory Addressing Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Multi-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues Introductory Sessions Beginning to Program Tokens Keywords Identifiers Literals Data Types Variables and Constants Operators (Arithmetic-Assignment-Unary-Relational-Logical) Expressions Statements and Formula Based Calculations BlueJ User Input Arguments through main Class Object Creation and Access Wrapper Classes Constructor Basics Constructor Overloading Conversion and Checking Functions Math Functions Function building and calling Function overloading Simple If and If-Else Selection Multiple Conditional Selections Switch Based Selections Basic Loop Types Compound or Nested Loops Jumping within loops Loop Variations Loop Applications - Handling Numerals Specially Named Numbers Series Printing Pattern Printing Scanner Input Buffered Input Array Basics Array Search Array Sorting Other Array Manipulations Two Dimensional Arrays Basics Two Dimensional Arrays Manipulations Character Handling String Basics String Class Functions StringBuffer StringBuilder Types of Errors Exceptions using try-catch Defining Classes Introductory Sessions Beginning to Program Introductory Sessions Beginning to Program Introductory Sessions Beginning to Program Data Types Variables and Constants Introductory Sessions Beginning to Program Python Basics Beginning To Program Tokens, Keywords, Identifiers Variables and Expressions Data Types Operators Building Expressions Collecting User Input elational nary)


Back