C04B-2017 – CSKC
Sign In

Search





Q&A #6057 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 : BOOK

Code BNAME TYPE
F101 The priest Fiction
L102 German easy Literature
C101 Tarzan in the lost world Comic
F102 Untold Story Fiction
C102 War Heroes Comic

TABLE: MEMBER

MNO MNANE CODE ISSUEDATE
M101 RAGHAV SINHA L102 2016-10-13
M103 SARTHAK JOHN F102 2017-02-23
M102 ANISHA KHAN C101 2016-06-12

(i) To display all details from table MEMBER in descending order of ISSUEDATE.

(ii) To display the BNO and BNAME of all Fiction Type books from the table BOOK

(iii) To display the TYPE and number of books in each TYPE from the table BOOK

(iv) To display all MNAME and ISSUEDATE of those members from table MEMBER who have books issued (i.e ISSUEDATE) in the year 2017.

(v) SELECT MAX(ISSUEDATE) FROM MEMBER;

(vi) SELECT DISTINCT TYPE FROM BOOK;

(vii) SELECT A.CODE,BNAME,MNO,MNAME FROM BOOK A, MEMBER B
WHERE A.CODE=B.CODE ;

(viii) SELECT BNAME FROM BOOK
WHERE TYPE NOT IN (“FICTION”, “COMIC”);

Answer:

(i) SELECT * FROM MEMBER ORDER BY ISSUEDATE DESC;

(ii) SELECT Code,BNAME FROM BOOK WHERE TYPE=’Fiction’;
OR
SELECT BNO,BNAME FROM BOOK WHERE TYPE=’Fiction’;

(iii) SELECT COUNT(*),TYPE FROM BOOK GROUP BY TYPE;

(iv) SELECT MNAME, ISSUEDATE FROM MEMBER WHERE
ISSUEDATE>=’2017-01-01′ AND ISSUEDATE<=’2017-12-31′;
OR
SELECT MNAME, ISSUEDATE FROM MEMBER WHERE ISSUEDATE
BETWEEN ‘2017-01-01’ AND ‘2017-12-31’;
OR
SELECT MNAME, ISSUEDATE FROM MEMBER WHERE ISSUEDATE
LIKE ‘2017%’;

(v)

MAX(ISSUEDATE)
2017-02-23

(vi)

DISTINCT TYPE
Fiction
Literature
Comic

(vii)
CODE     BNAME                               MNO   MNAME
L102      The priest                            M101   RAGHAV SINHA
F102      Untold Story                       M103   SARTHAK JOHN
C101      Tarzan in the lost world    M102   ANISHA KHAN

(viii)
BNAME
German Easy
OR
BNAME
The priest
German easy
Tarzan in the lost world
Untold Story
War heroes


Share

C. Sir| Created: 9-Jan-2019 | Updated: 20-May-2026|CBSE12D-2017









×
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 Display Using IO Manipulation User Defined Data Types Enumerated Types Preprocessor Directives And Macros Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constructor Concepts Default Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays 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 Class Object Creation and Access Wrapper Classes Constructor Basics Conversion and Checking Functions Math Functions Function building and calling Simple If and If-Else Selection Switch Based Selections Basic Loop Types Array Basics Array Search Array Sorting Character Handling String Basics String Class Functions Types of Errors Try Catch 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 Date and Time Handling Regular Expressions Command Line Arguments Concurrent Execution Making Executable File Python Introduction (Features Python Introduction (Features, Installation, Modes) Handling Unicode Internet Interactions Imaging and Compression Special Data File Handling Python Basics Cryptography Blockchain and Cryptocurrency Generative AI keywords, identifiers, variables Beginning To Program Tokens, Keywords, Identifiers Variables and Expressions Data Types Operators Concept Learning Examples Operators Solved Practical Examples elational nary)