Page 47 - ipp11
P. 47
30. (a) Write an SQL statement to create a table named TRAINS, with the following specifications: [3]
Column Name Data Type Constraints
Train_No Numeric Primary Key
Train_Name Varchar (50) NOT NULL
Source Varchar (50)
Destination Varchar (50)
Departure_Date Date
Ticket_Price Decimal (5,2)
Or
(b) Write SQL commands to perform the following tasks:
(i) Create a database named Coach.
(ii) Open the database Coach.
(iii) Display the structure of the existing table, i.e., Sports.
Ans. (a) CREATE TABLE TRAINS
(
TRAIN_NO INTEGER PRIMARY KEY,
TRAIN_NAME VARCHAR(50) NOT NULL,
SOURCE VARCHAR(50),
DESTINATION VARCHAR(50),
DEPARTURE_DATE DATE,
TICKET_PRICE DECIMAL(5,2)
);
Or
(b) (i) CREATE DATABASE COACH;
(ii) USE COACH;
(iii) DESCRIBE SPORTS;
31. Consider the following table: [3]
Table: ONLINE_ORDERS
Order_ID Customer_Name Product Amount Order_Date
O201 Priyank Sharma Headphones 2500 2025-05-01
O202 Ashima Verma Smartwatch 5500 2025-05-03
O203 Nishant Khanna Laptop 45000 2025-05-04
O204 Devika Mehta Smartphone 30000 2025-05-07
O205 Radhika Das Keyboard 1500 2025-05-10
(a) Write a query to display the names of customers who ordered products costing more than 4500.
(b) Write a query to display the details of orders placed after May 05, 2025.
(c) Write a query to display the customer names and products for orders having Order_ID 0204.
Ans. (a) Select Customer_Name from Online_Orders where Amount > 4500;
(b) Select * from Online_Orders where Order_Date > 2025–05–05;
(c) Select Customer_Name, Product from Online_Orders where Order_ID = 0204;
Section D (4 × 4 = 16 Marks)
32. (a) Write a Python program to check whether a number is Armstrong number or not. [4]
Or
(b) Write a menu-driven Python program to perform the following operations.
The menu should display the following:
(i) Check Positive or Negative or Zero (ii) Check Even or Odd
(iii) Find Greatest of 3 Numbers (iv) Exit
M.17