C05B – Computer Sir Ki Class

Login


Lost your password?

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

Login
[lwa]



Q&A CBSE12A-2016-C05B #5693 siteicon  

Question:

Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables

Table: VEHICLE

VCODE VEHICLETYPE PERKM
V01 VOLVO BUS 150
V02 AC DELUXE BUS 125
V03 ORDINARY BUS 80
V05 SUV 30
V04 CAR 18

Note: PERKM is Freight Charges per kilometer

Table: TRAVEL

CNO CNAME TRAVELDATE KM VCODE NOP
101 K.Niwal 2015-12-13 200 V01 32
103 Fredrick Sym 2016-03-21 120 V03 45
105 Hitesh Jain 2016-04-23 450 V02 42
102 Ravi Anish 2016-01-13 80 V02 40
107 John Malina 2015-02-10 65 V04 2
104 Sahanubhuti 2016-01-28 90 V05 4
106 Ramesh Jaya 2016-04-06 100 V01 25

Note:

  • Km is Kilometers travelled
  • NOP is number of passengers travelled in vehicle

(i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.

(ii) To display the CNAME of all the customers from the table TRAVEL who are traveling by vehicle with code V01 or V02.

(iii) To display the CNO and CNAME of those customers from the table TRAVEL who travelled between ’2015-12-31’ and ‘2015-05-01’.

(iv) To display all the details from table TRAVEL for the customers, who have travel distance more than 120 KM in ascending order of NOP.

(v) SELECT COUNT(*),VCODE FROM TRAVEL GROUP BY VCODE HAVING COUNT(*)>1;

(vi) SELECT DISTINCT VCODE FROM TRAVEL;

(vii) SELECT A.VCODE,CNAME,VEHICLETYPE
FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND KM<90;

(viii) SELECT CNAME,KM*PERKM
FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND A.VCODE=’V05′;

Answer:

(i) SELECT CNO, CNAME, TRAVELDATE FROM TRAVEL ORDER BY CNO DESC;

(ii) SELECT CNAME FROM TRAVEL WHERE VCODE=’V01′ OR VCODE=’V02′;
OR
SELECT CNAME FROM TRAVEL WHERE VCODE IN (‘V01’, ‘V02′);

(iii) SELECT CNO, CNAME from TRAVEL WHERE TRAVELDATE >=’2015-05-01’ AND TRAVELDATE <= ‘2015-12-31’;
OR
SELECT CNO, CNAME from TRAVEL
WHERE TRAVELDATE BETWEEN ‘2015-05-01’ AND ‘2015-12-31’ ;
OR
SELECT CNO, CNAME from TRAVEL
WHERE TRAVELDATE <= ‘2015-12-31’ AND TRAVELDATE >= ‘2015-05-01’;
OR
SELECT CNO, CNAME from TRAVEL
WHERE TRAVELDATE BETWEEN ‘20151231’ AND ‘20150501’ ;

(iv) SELECT * FROM TRAVEL
WHERE KM > 120 ORDER BY NOP;

(v) COUNT(*)     VCODE
2                      V01
2                      V02

(vi) DISTINCT VCODE
V01
V02
V03
V04
V05

(vii) VCODE    CNAME         VEHICLETYPE
V02          Ravi Anish     AC DELUXE BUS
V04          John Malina  CAR

(viii) CNAME            KM*PERKM
Sahanubhuti    2700


Share

CSKC| Created: 1-Jan-2019 | Updated: 4-Jan-2019|CBSE12A-2016






×
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