0% found this document useful (0 votes)
621 views

Higher Secondary Computer Application - MySQL Practical

The document contains SQL queries to create and populate tables to store student, employee, stock, and bank account data. The queries perform operations like updating fields, selecting records that meet certain criteria, and modifying data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
621 views

Higher Secondary Computer Application - MySQL Practical

The document contains SQL queries to create and populate tables to store student, employee, stock, and bank account data. The queries perform operations like updating fields, selecting records that meet certain criteria, and modifying data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Database queries using MySQL 18.

Create a table Employee with the following fields and


17. Create a table Student with the following fields and insert at least 5 records
insert at least 5 records into into the table except the column Gross_pay and DA.
the table except for the column Total. Emp_code Integer Primary key
Roll_Number Integer Primary key Emp_name Varchar (20)
Name Varchar (25) Designation Varchar (25)
Batch Varchar (15) Department Varchar (25)
Mark1 Integer Basic Decimal (10,2)
Mark2 Integer DA Decimal (10,2)
Mark3 Integer Gross_pay Decimal (10,2)
Hsslive.in
Total Integer
a. Update DA with 75% of Basic.
a. Update the column Total with the sum of Mark1,
b. Display the details of employees in Purchase, Sales and
Mark2 and Mark3.
HR departments.
b. List the details of students in Commerce batch.
c. Update the Gross_pay with the sum of Basic and DA.
c. Display the name and total marks of students who are
d. Display the details of employee with gross pay below
failed (Total < 90).
10000.
d. Display the name of students in alphabetical order and
in batch based.
create table employee
(emp_code integer primary key,
create table student
emp_name varchar(20),
(roll_no int primary key,
designation varchar(25),
name varchar(25),
department varchar(25),
batch varchar(25),
basic decimal(10,2),
mark1 int,
da decimal(10,2),
mark2 int,
gross_pay decimal(10,2));
mark3 int,
total int);
insert into employee values
(1,"Binu","Manager","Sales",25000,null,nul
insert into student values
l),
(1,'Binu','CS',98,99,85,null),
(2,"Archana","manager","Sales",23000,null,
(2,'Shyam','COM',97,99,95,null),
null),
(3,'Vimal','COM',55,65,78,null),
(3,"Gayathri","clerk","office
(4,'Vignesh','CS',95,65,98,null),
staff",5000,null,null),
(5,'Sanjay','CS',12,25,20,null);
(4,"Aryan","Asst
Manager","HR",26000,null,null),
select * from student;
(5,"krishna","clerk","office
staff",6000,null,null);
a) update student
set total=mark1+mark2+mark3;
a) update employee
set da=basic*75/100;
b)select * from student
where batch='COM';
b) select * from employee
where department
c)select name,total from student
in("sales","hr","purchase");
where total<90;

d)select name,batch from student


c) update employee
order by batch,name asc;
set gross_pay=basic+da;

d) select * from employee


where gross_pay<10000;
19. Create a table Stock, which stores daily sales of items 20. Create a table Bank with the following fields and
in a shop, with the insert at least 5 records into the
following fields and insert at least 5 records into the table.
table. Acc_No Integer Primary key
Item_code Integer Primary key Acc_Name Varchar (20)
Item_name Varchar (20) Branch_Name Varchar (25)
Manufacturer_Code Varchar (5) Acc_ Type Varchar (10)
Qty Integer Amount Decimal (10,2)
Unit_Price Decimal (10,2) a. Display the account details of "Savings Account" in
c. Display the item names with stock zero. Kodungallur branch.
d. Display the number of items manufactured by the b. Change the branch name "Trivandrum" to
same manufacturer. "Thiruvananthapuram".
c. Display the highest price and lowest quantity in the c. Display the details of customers in
stock. Thiruvananthapuram, Ernakulam and
d. Increase the unit price of all items by 10%. Kozhikode.
d. List the details of customers in Thrissur branch having
a minimum balance of Rs. 5000.
create table stock
(item_code int primary key,
item_name varchar(20), create table bank
man_code varchar(5), (acc_no int primary key,
qty integer, acc_name varchar(20),
price decimal(10,2)); branch_name varchar(20),
acc_type varchar(20),
insert into stock values amount decimal(10,2));
(100,'laptop','hp',100,25000),
(101,'desktop','dell',10,15000), insert into bank values
(121,'Binu','Kodungallur','savings',25000),
(102,'printer','dell',103,5000),
(122,'Shyam','Trivandrum','savings',5000),
(104,'scanner','dell',0,35000),
(123,'Arun','Kozhikkodu','savings',55000),
(105,'laptop','acer',50,35000);
(124,'Sarath','Ernakulam','savings',75000),
(125,'Hari','thrissur','savings',4000);
select item_name from stock
where qty=0; a)select * from bank
where branch_name='kodungallur';
select item_name,count(*) from
stock group by man_code; b)update bank
set branch_name='Thiruvananthapuram'
select max(price),min(qty) from stock; where branch_name='Trivandrum';

update stock c)SELECT * FROM bank WHERE branch_Name IN


set price=price+price*10/100; ( ’ Thiruvananthapuram ’ , ’ Kozhikkodu’ , ’
Ernakulam ’) ;

d) select * from bank


where amount<5000 and
branch_name='thrissur';

You might also like