0% found this document useful (0 votes)
73 views33 pages

ISM Kartik Arora

The document appears to be a practical file submitted by a student named Kartik Arora for an Information Systems Management course. It contains 35 questions related to performing SQL queries on sample tables like creating tables, inserting records, updating records, and selecting records based on various conditions. The questions are divided into 5 sections covering basic SQL commands like CREATE, SELECT, INSERT, UPDATE, ALTER etc. and functions like COUNT, AVG, GROUP BY etc.

Uploaded by

kartik arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views33 pages

ISM Kartik Arora

The document appears to be a practical file submitted by a student named Kartik Arora for an Information Systems Management course. It contains 35 questions related to performing SQL queries on sample tables like creating tables, inserting records, updating records, and selecting records based on various conditions. The questions are divided into 5 sections covering basic SQL commands like CREATE, SELECT, INSERT, UPDATE, ALTER etc. and functions like COUNT, AVG, GROUP BY etc.

Uploaded by

kartik arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

TRINITY INSITUTE OF PROFESSIONAL STUDIES

(AFFILIATED TO GGSIPU)

(INFORMATION SYSTEM MANAGEMENT)

(PRATICAL FILE)

BATCH 201 9-2022

Under the Guidance Submitted By

Dr. Surabhi Shanker Kartik Arora


Associate Professor BBA 4(C)
07324001719
INDEX
S.NO. TOPIC PAGE NO. SIGN REMARKS

1 Introduction to SQL 1
2 Definition of SQL 2
Characteristics of SQL
3 Advantages of SQL 3
4 Types of SQL statements 4

5 Data types in SQL 5

6 Literal in SQL 6

PRACTICAL-1

7 Create Table related to student records with 7


columns Roll No., Name, Subject and Marks
8 Describe the table 7

9 Insert records in the Student Table. 8

10 Display the detail of all the students. 8

11 Display the details of Students whose marks 9


is greater than 70.
12 Display the details of Students whose subject 9
is ‘Computer”.
13 Display the details of Students whose name 10
starts with ‘A’.
14 Display the details whose marks are in 10
between 70 to 80.
15 Display the details of students whose marks 11
is either 70 or 80.
16 Display the details of students whose subject 11
is either Maths or Computer.
PRACTICAL-2

17 Create a table student with column Roll No. 12


Name, Subject, Marks.(CREATE Command)
18 Update the Marks of the student to 95 whose 12
roll no. is 5(Update Command)

19 Add a column whose name is Phone No. and 13


data type is ‘int’.(Alter, Add)
20 Delete the column whose name is Phone 13
No.(Alter, Drop)
21 Modify the data type of column named 14
“Name’ to char(20).(Alter, Modify)
22 Modify the table to Student Details.(Alter, 14
Rename)
PRACTICAL-3
23 Create a student table having attributes 15
Roll_No, Name, Subject and Marks
24 Insert five records in it. Display all the 15
records.
25 Display subject wise average marks. (Use 16
Group By and AVG Function)
26 Display sum of the marks of each sub 16

27 Count no of entries of each subject marks. 17

28 Find the Maximum Marks and Group by 17


subject.
PRACTICAL-4
29 Create a table Bakery and mention the fields 18
item_no, Item_name, Item_Supplier,
item_Supply_date, item_Quantity,
item_price. Make item_No as primary key.
30 Insert 5 record in the table. 18

31 Display all the record in the table. 19

32 Display all such items which has 19


having quantity more than 200.
33 Display all the records where item name 20
starts with alphabet ‘B’.
34 Display all the records where there the price 20
range is in between 5000 to 15000
35 Display all the records where item name is 21
either Milk or Ice cream.
36 PRATICAL -5 22
CREATE TABLE CLIENT_MASTER -
CREATE TABLE PRODUCT_MASTER 25
CREATE TABLE SALESMAN_MASTER
INTRODUCTION TO
SQL

DEFINITION :

• SQL is a DB Language that allow the users to create the


database and relational Structure.

• It helps to perform various tasks like Insertion, Modification and


Deletion.

• It performs Both simple and complex queries.

1
CHARACTERISTICS :
• SQL is an ANSI(American National Standard Institute) and
ISO(International Organization for Standardization) standard
computer language for creating and manipulating databases.

• SQL allows the users to create, Update, Delete and retrieve


data from a Database.

• SQL is very simple and easy to learn.

• SQL works with Database Program like DB2, Oracle, MS Access, MS


SQL etc.

2
ADVANTAGES :
• Faster Query Processing: Large amount of data is retrieved quickly
and efficiently. Operations like Insertion, deletion, manipulation of
data is also done in almost no time.

• No Coding Skills: For data retrieval, large number of lines of code is


not required. All basic keywords such as SELECT, INSERT INTO,
UPDATE, etc are used and also the syntactical rules are not complex
in SQL, which makes it a user-friendly language.

• Standardized Language: Due to documentation and long


establishment over years, it provides a uniform platform worldwide
to all its users.

• Portable: It can be used in programs in PCs, server, laptops


independent of any platform (Operating System, etc). Also, it can be
embedded with other applications as per need/requirement/use.

• Interactive Language: Easy to learn and understand, answers to


complex queries can be received in seconds.

3
SQL STATEMENTS

1.DDL (Data Definition Language 1.1 CREATE 1.2 ALTER 1.3


DROP
2. DML (Data Manipulation Language
2.1 SELECT 2.2 INSERT 2.3 UPDATE 2.4 DELETE
3.DCL (Data Control Language) 3.1 GRANT 3.2 REVOKE
4. TCL (Transaction Control Language)
4.1 COMMIT 4.2 ROLLBACK 4.3 SAVEPOINT

Data Types in SQL:

CHAR- It will accept character strings of fixed length. The length of the
character string should be specified in the data type declaration.
Syntax: CHAR(Length)

VARCHAR: Accepts character strings of variable length which is up to


maximum length specified in the data type declaration.
Syntax: VARCHAR(Length)

INTEGER/INT: It will accept numeric values.

4
Syntax: INT

Date: Accept date values. No parameters are required when declaring a


DATE data type.
Syntax: DATE

BOOLEAN: Supports the storage of two values: TRUE or FALSE. No


parameter are required when declaring a BOOLEAN data type.
Syntax: BOOLEAN

DECIMAL: Accepts numeric values for which you may define a


precision and a scale in the data type declaration. The precision is a
positive integer that indicates the number of digits that the number will
contain. The scale is a positive integer that indicates the number of these
digit that will represent decimal places to the right of the decimal point.
Syntax: DECIMAL (Precision, Scale) For Example: 12.56
LITERALS IN SQL:

STRING LITERALS: String Literals are surrounded by single quotes.

Eg. ‘This is a Literal.’

INTEGER LITERALS: Can be either positive numbers or negative


numbers, but do not contain decimals. If you do not specify a sign, then
positive number is assumed.

5
Eg. 547

DECIMAL LITERALS: Can be either positive numbers or negative


numbers & contain decimals. If you do not specify a sign, then a positive
number is assumed.

Eg. 5.78

DATA TIME LITERALS: Are character representation of date time


values that are enclosed in single quotes.

Eg. ‘2015/04/30’

PRACTICAL 1

Que.1: Create Table related to student records with columns Roll No.,
Name, Subject and Marks.

6
Que.2: Describe the table.

Que.3: Insert records in the Student Table.

7
4. Que.4: Display the details of all the students.

Que.5: Display the details of Students whose marks is greater than 70.

8
9
Que.6: Display the details of Students whose subject is ‘Computer”.

Que.7: Display the details of Students whose name starts with ‘A’.

10
Que.8: Display the details whose marks are in between 70 to 80.

Que.9: Display the details of students whose marks is either 70 or 80.

11
Que.10: Display the details of students whose subject is either Maths or
Computer.

PRATICAL 2

Que. 1: Create a table student with column Roll No. Name, Subject,
marks

12
Que. 2: Update the Marks of the student to 95 whose roll no. is 5.

13
14
Que. 3: Add a column whose name is Phone No. and data type is ‘int’.

Que.4: Delete the column whose name is Phone No.(Alter, Drop )

15
Que.5: Modify the data type of column named “Name’ to char(20).

16
Que.6: Modify the table to Student Details.(Alter, Rename)

17
PRATICAL 3

Que. 1: Create a student table having attributes Roll_No, Name, Subject


And marks.

18
Que. 2: Insert five records in it. Display all the records.

19
Que. 3: Display subject wise average marks. (Use Group By and
AVG Function)

Que. 4: Display sum of the marks of each subject.

20
Que. 5: Count no of entries of each subject marks.

21
Que. 6: Find the Maximum Marks and Group by subject.

PRATICAL 4

Que. 1: Create a table Bakery and mention the fields item_no


, Item_name, Item_Supplier, item_Supply_date, item_Quantity,
item_price . Make item_No as primary key.

22
Que. 2: Insert 5 record
in the table.

Que. 3: Display all the record in the table.

23
24
Que. 4: Display all such items which has having quantity more than 200.

25
Que. 5: Display all the records where item name starts with alphabet ‘B’.

Que. 6: Display all the records where there the price range is in between
5000 to 15000.

26
Que. 7: Display all the records where item name is either Milk or Ice-
cream.

PRATICAL-5

1.Create table Client_master as the below given format

27
2. Create table Product_Master as the below given format

3. Create table Salesman_Master as the below given format

28
29

You might also like