0% found this document useful (0 votes)
11 views24 pages

ISM File

doc

Uploaded by

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

ISM File

doc

Uploaded by

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

ISM PRACTICAL FILE

Submitted to: Ms. Dolly Sharma


Submitted by: Harsh Kumar
Enrollment number: 01614101721
INDEX
S. No Particular Page no Remarks
1 What is DBMS? Explain its feature?

2 Define various keys with examples.

3 What is SQL? Discuss its advantages

4 What is MYSQL? Discuss the types of commands in MYSQL

5 Show the steps to connect to the MYSQL sever through XAMPP

6 Create table EMP in SQL with 5 columns.

7 nsert records in table EMP.

8 Write a query selecting E_name in descending order.

9 Write a query selecting 3 columns of employee.

10 Change the name of the employee with E_ID=5 as Parth.

11 Add a column “Salary” after DOJ and assign salary to each employee.

12 Write a query to find the maximum salary.

13 3 Write a query to find the name of the employee having maximum


salary.
14 Write a query to display the dept_id in descending Order.

15 Write a query to count the number of employees belonging to Dept_No


12 in EMP using a single query.
16 Delete the record with E_id=4,5 using a single query

17 Delete the column DOJ from the table EMP

18 Delete all the records from the table EMP using a single query.

19 Delete the table EMP.

20 Delete the database Employee?

21 Create a table for Bank detail Bank Customers with Primary Key as their
account number.
22 Insert the database for 10 customers in bank detail.

23 Show the entry for Null Entry for Customer account number in table
bank detail
24 Count the records where balance is greater than 50000.

25 Delete the rows from the table bank detail where balance is between
10000 & 20000.
26 Define the functions with examples
Q1 What is DBMS? Explain its features.

Database Management System (DBMS) is a software for storing and retrieving users'
data while considering appropriate security measures. It consists of a group of programs
which manipulate the database. DBMS allows users to create their own databases as per
their requirement. The term “DBMS” includes the user of the database and other
application programs. It provides an interface between the data and the software
application.

FEATURES

Data Retrieval

DBMS database management system accepts data input from users and stores it. Users
can access the database later on to retrieve their records as a file, printed, or viewed on
the screen.

Query Languages

A typical DBMS makes it possible to use query languages for collecting, searching,
sorting, modifying and other activities that help users manipulate their records in the
database.

Multi-user Access

DBMS provides multiple users access to all types of information stored in one and the
same data store. There is also a security feature that prevents some users from viewing
and/or modifying certain data types.

Data Integrity

All information in a database is accessible by several or more users but only one user can
change the same piece of data at a time. This capability lets prevent database corruptions
and failure.
Metadata

DBMS database management software provides a metadata library (or a data dictionary)
that describes how the database is organized and what elements (objects, related files,
records, etc.) compose its structure.
Q2 Define various keys with examples
Primary key

Primary key - A primary key is a field in a table which uniquely identifies each
row/record in a database table. Primary keys must contain unique values. A primary key
column cannot have NULL values.

A table can have only one primary key, which may consist of single or multiple fields.
When multiple fields are used as a primary key, they are called a composite key.

If a table has a primary key defined on any field(s), then you cannot have two records
having the same value of that field(s).
STUDENT
STUDENT NAME AGE STUDENT EMAIL
ID ENROLL. NO.
098 012450 SHRUTI 23 [email protected]
066 012654 DIYA 24 [email protected]
087 012346 DEEPAL 22 [email protected]
In this table Student Id is Primary key.

Secondary key

Secondary Key is the key that has not been selected to be the primary key. However, it is
considered a candidate key for the primary key.

Therefore, a candidate key not selected as a primary key is called secondary key.
Candidate key is an attribute or set of attributes that you can consider as a Primary key.
STUDENT STUDENT
NAME AGE STUDENT EMAIL
ID ENROLL. NO.
098 012450 SHRUTI 23 [email protected]
066 012654 DIYA 24 [email protected]
087 012346 DEEPAL 22 [email protected]
Student enroll and student email are Secondary keys.

Alternate key

Alternate Key or Secondary Key is the key that has not been selected to be the primary
key, but are candidate keys.

However, it is considered a candidate key for the primary key. A candidate key not
selected as a primary key is called alternate or secondary key. Candidate key is an
attribute or set of attributes that you can consider as a Primary key.

STUDENT STUDENT
NAME AGE STUDENT EMAIL
ID ENROLL. NO.
098 012450 SHRUTI 23 [email protected]
066 012654 DIYA 24 [email protected]
087 012346 DEEPAL 22 [email protected]

Student enroll and student email are Alternate keys.

Candidate key

Candidate key - Each table has only a single primary key. Each relation may have one or
more candidate key. One of these candidate key is called Primary Key. Each candidate
key qualifies for Primary Key. Therefore candidates for Primary Key is called Candidate
Key.
STUDENT STUDENT
NAME AGE STUDENT EMAIL
ID ENROLL. NO.
098 012450 SHRUTI 23 [email protected]
066 012654 DIYA 24 [email protected]
087 012346 DEEPAL 22 [email protected]
Student id, Student Enroll, Student Email are all candidate

keys

Foreign Key

A Foreign Key is a field (or collection of fields) in one table, that refers to the Primary
Key in another table.

The table with the foreign key is called the child table, and the table with the primary key
is called the referenced or parent table. Look at the following two tables:

Persons Table

Order Table
Notice that the "PersonID" column in the "Orders" table points to the "PersonID"
column in the "Persons" table.

The "PersonID" column in the "Persons" table is the PRIMARY KEY in the "Persons"
table.

The "PersonID" column in the "Orders" table is a FOREIGN KEY in the "Orders" table.

Q3What is SQL? Discuss its advantages

SQL is Structured Query Language, which is a computer language for storing,


manipulating and retrieving data stored in a relational database.

SQL is the standard language for Relational Database System. All the Relational
Database Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase etc.
and SQL Server use SQL as their standard database language.

Advantages of SQL:
High Speed:

SQL Queries can be used to retrieve large amounts of records from a database quickly
and efficiently.

Well Defined Standards Exist:

SQL databases use long-established standard, which is being adopted by ANSI &
ISO. Non-SQL databases do not adhere to any clear standard.

No Coding Required:

Using standard SQL it is easier to manage database systems without having to write
substantial amount of code.
Q4 What is MYSQL? Discuss the types of commands in MYSQL

MySQL, pronounced either "My S-Q-L" or "My Sequel" is an open source relational
database management system. It is based on the structure query language (SQL), which
is used for adding, removing, and modifying information in the database. Standard SQL
commands, such as ADD, DROP, INSERT, and UPDATE can be used with MySQL.

MySQL can be used for a variety of applications, but is most commonly found on Web
servers. A website that uses MySQL may include Web pages that access information
from a database. These pages are often referred to as "dynamic" meaning the content of
each page is generated from a database as the page loads. Websites that use dynamic
Web pages are often referred to as database-

driven websites.

MYSQL Commands-
Q5 Show the steps to connect to the MYSQL sever through XAMPP
Steps-

1. Open Xampp from start


2. Start ever option in it and minimise
3. Now open cmd and type-

C:\Users\student>cd..
C:\Users>cd..
C:\>cd xampp
C:\xampp>cd mysql
C:\xampp\mysql>cd bin
C:\xampp\mysql\bin>mysql –u root –p “” –h 127.0.0.1
Enter password: ( press enter)
Q6Create table EMP in SQL with 5 columns.

Q7.Insert records in table EMP


Q8Write a query selecting E_name in descending order
Q9Write a query selecting 3 columns of employee

Q10Change the name of the employee with E_ID=5asParth


Q11 Add a column “Salary” after DOJ and assign salary to each employee.
Q12 Write a query to find the maximum salary.

Q13 Write a query to find the name of the employee having maximum
salary.
Q14 Write a query to display the dept_no in descending order.
Q16 Delete the record with E_id=6, 8, 9 using a single query.

Q17 Delete the column DOJ from the table EMP


Q18 Delete all the records from the table EMP using a single query

Q19 Delete the table EMP

Q20 Delete the database


Q21 Create a table for Bank detail Bank Customers with Primary Key as
their account number.

Q22 Insert the database for 10 customers in bank_detail

Q23 Show the entry for Null Entry for Customer account number in table
bank_detail
Q24 Count the records where balance is greater than 50000

Q25 Update the table bank_detail for the balance equal to 10000 if it is
less than 10000

Q26 Delete the rows from the table bank_detail where balance is between
10000&20000
Q27 Define the functions with examples
A function is a set of SQL statements that perform a specific task. Functions foster code
reusability. If you have to repeatedly write large SQL scripts to perform the same task,
you can create a function that performs that task. Next time instead of rewriting the
SQL, you can simply call that function. A function accepts inputs in the form of
parameters and returns a value. SQL Server comes with a set of built in functions that
perform a variety of tasks.
There are two types of SQL functions, aggregate functions, and scalar(nonaggregate)
functions. Aggregate functions operate on many records and produce a summary,
works with GROUP BY whereas non-aggregate functions operate on each record
independently.
SQL Aggregate Function -This function can produce a single value for an entire group or
table. They operate on sets of rowsand return results based on groups of rows.
Some Aggregate functions are –
• SQL Count function
• SQL Sum function
• SQL Avg function
• SQL Max function
• SQL Min function
SQL Arithmetic Function - A mathematical function executes a mathematical
operation usually based on input values that are provided as arguments, and return a
numeric value as the result of the operation. Mathematical functions operate on numeric
data such as decimal, integer, float, real, smallint, andtinyint.
Some Arithmetic functions are –
• abs()
• ceil()
• floor()
• exp()
• ln()
• mod()
• power()
• sqrt()
SQL Character Function - A character or string function is a function which takes one
or more characters or numbers as parameters and returns a character value. Basic
string functions offer a number of capabilities and return a string value as a result set.
Some Character functions are -
• lower()
• upper()
• trim()
• translate()

You might also like