ISM file
ISM file
Syntax:
create table student(std_id int, name varchar(30), email varchar(50), phone_number varchar(10));
insert into student value(1, "shubham", "[email protected]", 9813470000);
insert into student value(2, "anshul", "[email protected]", 8463182345);
insert into student value(3, "shashu", "[email protected]", 9845684444);
insert into student value(4, "agrim", "[email protected]", 7510022222);
insert into student value(5, "aryan", "[email protected]", 8512032222);
select*from student
1
Ques 2: Create Employee information table.
Creating a basic table involves naming the table and defining its columns and each column’s data type:
2
OUTPUT:
3
Ques 3: Display the salary of all employees from Employee Information
table.
create table emp_info(emp_id int, name varchar(20), email varchar(50), hire_date int, salary int,
department varchar(20), city varchar(20));
QUERY
insert into emp_info value(1001, "kunal", "[email protected]", 2012-05-01, 25000, "HR", "Delhi");
insert into emp_info value(1002, "ramesh", "[email protected]", 2022-05-01, 30000, "Sales",
"Mumbai");
insert into emp_info value(1003, "priyanshu", "[email protected]", 2022-01-01, 50000,
"Finance", "Agra");
insert into emp_info value(1004, "khwab", "[email protected]", 2023-01-01, 40000, "HR", "Delhi");
insert into emp_info value(1005, "rishi", "[email protected]", 2011-07-01, 70000, "Finance",
"Hyderabad");
Select Salary from employee Information.
OUTPUT:
4
Ques 4: Display the different department in the company from Employee
Information.
create table emp_info(emp_id int, name varchar(20), email varchar(50), hire_date int, salary int,
department varchar(20), city varchar(20));
insert into emp_info value(1001, "kunal", "[email protected]", 2012-05-01, 25000, "HR", "Delhi");
OUTPUT:
5
Ques 5. Display total number of departments in the company from Employee
Information table.
First, we have to display the table where all the records are entered for the following command is: -
select * from Emp_info; The table will execute with the fields you have entered.
Here we will use an aggregate function: - COUNT () It returns the number of rows in a table. It allows you
to count all rows or only rows that match a specified condition.
OUTPUT:
6
Ques 6: Display the name of employees whose name starts with ‘a’.
Under this LIKE operator is used to search for a specified pattern in a columnthereare 2 wildcards often
used in conjunction with the like operator: %,
We also used WHERE clause in the command. WHERE clause allows you to specify search condition
for the rows returned by the query WHERE clause select statement is to filter rows from the result set.
VALUE IN TABLE:
OUTPUT:
7
Ques 7 . Display the name of those employees whose second alphabet is ‘a’.
Under this Like operator is used to search for a specified pattern in a colums. There are 2 wildcards ofter
used in conjunction with the like operator: %,_%: Represents zero or more characters._: Represents a single
character.
We have also used Where clause in this command. Where clause allows you tospecify a
search condition for the rows returned by a query. Where clause in select statement is to
filter rows from the result set.
OUTPUT:
8
Ques 8 . Display Id and name of those employees who lives in Delhi.
Under this command WHERE clause allows you to specify a search condition for the rows returned by
the query WHERE clause select statement is to filter rows from the result set.
It will display the ID and Name of those who live in Delhi only INSERT
VALUE IN TABLE:
OUTPUT:
9
Ques 9. Display Id and name of those employees who lives in Delhi/Mumbai.
Under this Where clause allows you to specify a search condition for the rows returned by aquery.
Where clause in select statement is to filter rows from the resultset. We have also used Or operator
which displays a record if any of the conditions separated by Or is True.
Syntax: Select column1, column 2,.. From table_name where condition 1 or condition 2 or
condition 3. ;
OUTPUT:
10
Ques 10. Display name & maximum salary in each department of company
Under this Where clause allows you to specify a search condition for the rows
returned by a query. Where clause in select statement is to filter rowsfrom the
result set.
Apart from that MAX () function is also used. It is an aggregate function that returns the
maximum value from an expression.
OUTPUT:
11
Ques 11 . Add phone no. column in employee information table.
Here ALTER command is used. It helps to modify an existing database and table. The ALTER
command is used. It helps to modify an existing database and table. The ALTER statement is used
to “ADD”, “DROP” and “MODIFY” the existing table.
Syntax (to add a column): ALTER table table_name ADD column_name, datatype;
12
OUTPUT:
13
Ques 12. Update the city of Ms. Sara Atray from Delhi to Uttar Pradesh
Here UPDATE statement is used. It helps to modify existing data in a table. Update statement
change values in one or more columns of a single row or multiple rows.
Query: Update emp_info set emp_city= “Uttar Pradesh” where emp_name= “SaraAtray”;
statement will change the city of sara from Delhi to Uttar Pradesh:
OUTPUT:
14
Ques 13. Make ER-Diagram of Hospital Management System.
Since hospitals are health care providers, thus they need to have efficient management. A hospital
management system ensures that information regarding health care is managed properly.
Furthermore, it also aids in the job completion of health care providers.
So, people use ER diagrams to design their hospital management systems. These ER diagrams
help them to visualize all the database tables and identify the relationships between different
entities and their attributes.
To better understand an ER diagram, we will discuss a few examples about ER diagram for hospital
management systems.
15
Ques 14. Make E-R Diagram of Examination System.
16