Lakshay ISM File 2.0
Lakshay ISM File 2.0
OF
INFORMATION SYSTEM MANAGENET
Submitted in the Partial fulfillment for the award of Degree of BACHELOR IN BUSINESS
ADMINISTRATION (G)
6 Pratical- 5 c r e a t e e m p _ i n f o t a b l e p r a t i c a l
Data within the most common types of databases in operation today is typically modelled
in rows and columns in a series of tables to make processing and data querying efficient. The
data can then be easily accessed, managed, modified, updated, controlled, and organised.
Most databases use structured query language (SQL)for writing and querying data.
Types of databases
There are many different types of databases. The best database for a specific
organisation depends onhow the organisation intends to use the data.
• Relational databases
Relational databases became dominant in the 1980s. Items in a relational database are
organised as aset of tables with columns and rows. Relational database technology
provides the most efficient and flexible way to access structured information.
• Object-oriented databases
Information in an object-oriented database is represented in the form of
objects, as inobject-oriented programming.
• Distributed databases
A distributed database consists of two or more files located in different sites.
The database may be stored on multiple computers, located in the same
physical location, orscattered over different networks.
• Data warehouses
A central repository for data, a data warehouse is a type of database specifically designed
for fast queryand analysis.
Database software is used to create, edit, and maintain database files and records,
enabling easier file and record creation, data entry, data editing, updating, and reporting.
The software also handles data storage, backup and reporting, multi-access control, and
security. Strong database security is especially important today, as data theft becomes
more frequent. Database software is sometimes alsoreferred to as a “database
management system” (DBMS).
Database software makes data management simpler by enabling users to store data in a
structured form and then access it. It typically has a graphical interface to help create and
manage the data and, insome cases, users can construct their own databases by using
database software.
MySQL database?
MySQL is an open source relational database management system based on SQL. It was designed
and optimised for web applications and can run on any platform. As new and different requirements
emerged with the internet, MySQL became the platform of choice for web developers and web-based
applications. Because it’s designed to process millions of queries and thousands of transactions,
MySQL is a popular choice for e-commerce businesses that need to manage multiple money
transfers.On-demand flexibility is the primary feature of MySQL.
MySQL is the DBMS behind some of the top websites and web-based applications in the
world,including Airbnb, Uber, LinkedIn, Facebook, Twitter, and YouTube.
Q2. Make ER- Diagram of Hospital management system
Q3. Make ER- Diagram of examination system
Q4. Create student table
Syntax:
• create table table name(column 1 datatype, column 2 datatype, column 3 datatype,.. column N
datatype);
• insert to table_name values(value1, value2, value3,………);
Query:
create table student(std_id int, name varchar(30), email varchar(50), phone_number varchar(10));
insert into student value(1, "Rahul", "[email protected]", 9911346811);
insert into student value(2, "Shaurya", "[email protected]", 7865450021);
insert into student value(3, "Gautam", "[email protected]", 8882345672);
insert into student value(4, "Vridhi", "[email protected]", 9823005431);
insert into student value(5, "Parth", "[email protected]", 9065478287);
select*from student
Output:
Q5 Create EMP_info table
Syntax:
• create table table name(column 1 datatype, column 2 datatype, column 3 datatype,.. column N
datatype);
• insert to table_name values(value1, value2, value3,………);
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales", "Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance", "Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 20000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 80000, "Finance", "Hyderabad");
select * from emp_info
Output:
Q6. Display the salary of all employees from EMP_ info table
Query:
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, "Rahul", "[email protected]", 2022-05-01, 15000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 50000, "Sales", "Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 40000, "Finance", "Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 20000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 90000, "Finance", "Hyderabad");
select salary from emp_info
Output:
Q7. Display different department in the company from EMP_info table
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales", "Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance", "Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 70000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 80000, "Finance", "Hyderabad");
select department from emp_info;
Output:
Q8. Display total number of departments in the company
Syntax:
• select count(column_name) from table_name;
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales",
"Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance",
"Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 70000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 90000, "Finance",
"Hyderabad");
select count(distinct department) as total_department from emp_info;
Output:
Q9. Display the name of employees whose name starts with ‘A’
Syntax:
• select column1, column2,… from table_name where condition;
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 50000, "Sales",
"Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 20000,
"Finance", "Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 90000, "HR",
"Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 10000, "Finance",
"Hyderabad");
select name from emp_info where name like 's%';
Output:
Q10. Display the name of those employees whose name
second alphabet is ‘A’
Syntax:
• select column1, column2,… from table_name where condition;
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales",
"Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance",
"Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 20000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 80000, "Finance",
"Hyderabad");
select name from emp_info where name like '_r%';
OUTPUT:
Q11. Display id and name of those employees who lives in Delhi
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales",
"Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance",
"Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 20000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 80000, "Finance",
"Hyderabad");
select emp_id, name from emp_info where city = "Delhi";
OUTPUT:
Q12. Display id and name of those employees who lives in Delhi/Mumbai
Syntax:
• select column1, column2,… from table_name where condition1 or condition2;
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales",
"Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance",
"Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 20000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 90000, "Finance",
"Hyderabad");
select emp_id, name from emp_info where city in ("Delhi", "Mumbai");
OUTPUT:
Q13 Display name and maximum salary in each department of company
Syntax:
• MAX(DISTINCT expression)
Query:
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, "Rahul", "[email protected]", 2022-05-01, 35000, "HR", "Delhi");
insert into emp_info value(1002, "Shaurya", "[email protected]", 2022-05-01, 40000, "Sales",
"Mumbai");
insert into emp_info value(1003, "Gautam", "[email protected]", 2022-01-01, 60000, "Finance",
"Agra");
insert into emp_info value(1004, "Vridhi", "[email protected]", 2022-01-01, 20000, "HR", "Delhi");
insert into emp_info value(1005, "Parth", "[email protected]", 2021-07-01, 90000, "Finance",
"Hyderabad");
Select department, max(salary) as max_salary from emp_info group by department;
OUTPUT:
Q14. Add phone number column in employee information table
Syntax:
• Alter table table_name add column_name, datatype;
Query:
• alter table emp_info add phone_number varchar(10);
• update emp_info set phone_number = '7592013380' where emp_id = 1001;
• update emp_info set phone_number = '8294012478' where emp_id = 1002;
• update emp_info set phone_number = '7921678366' where emp_id = 1003;
• update emp_info set phone_number = '9716004688' where emp_id = 1004;
• update emp_info set phone_number = '8920159933' where emp_id = 1005;
OUTPUT:
Q15. Update the city of Ms. Sara Atray from Delhi to Uttar Pardesh
Syntax:
• update table_name set column1 = value where some_column = some_value;
Query:
• update emp_info set city = 'Uttar Pradesh' where name = 'Sara Atray' and city = 'Delhi';
OUTPUT: