uday0097 / SQLAssignmentsSubmission

Here you can submit your SQL Assignments answers
0 stars 0 forks source link

SQL ASSIGMENT 1 #1

Open kanchanpal710 opened 7 months ago

kanchanpal710 commented 7 months ago

create table Employees(EmployeeID int, Primary Key(EmployeeID), FirstName Varchar(50), LastName Varchar(50), Department Varchar(50), Salary int);

select *from employees;

insert into Employees(EmployeeID,FirstName,LastName,Department,Salary) values(5678,'vikas','pal','IT',60000); insert into Employees(EmployeeID,FirstName,LastName,Department,Salary) values(1239,'kajal','singh','teaching',30000); insert into Employees(EmployeeID,FirstName,LastName,Department,Salary) values(9876,'shrihaan','pal','medical',90000);

select*from Employees;

insert into Employees(EmployeeID,FirstName,LastName,Department,Salary) values(9886,'yuvan','pal','acting',60000);

select *from Employees where Salary>50000;

select firstname, count(*) as num_employe from Employees group by Firstname;

select firstname, count(*) as num_employe from Employees GROUP by Firstname;

update Employees SET salary=50000 where salary=30000;

uday0097 commented 7 months ago

Good kanchan Keep going on

JyothiPinnam commented 6 months ago

use Training1;

Create table Employees2 (EmployeeID int Primary key , FirstName Varchar(20), LastName Varchar(20), Department varchar(20), Salary int);

insert into Employees2 (EmployeeID ,FirstName ,LastName ,Department ,Salary) values (101,'Sita','Mitra','Finance',12000); insert into Employees2 (EmployeeID ,FirstName ,LastName ,Department ,Salary) values (102,'Gita','Mitra','Finance',7000); insert into Employees2 (EmployeeID ,FirstName ,LastName ,Department ,Salary) values (103,'Neha','Chowdary','Marketing',5000); insert into Employees2 (EmployeeID ,FirstName ,LastName ,Department ,Salary) values (104,'Mounika','Injeti','Hr',15000); insert into Employees2 (EmployeeID ,FirstName ,LastName ,Department ,Salary) values (105,'Madhu','Chevva','Hr',8000); insert into Employees2 (EmployeeID ,FirstName ,LastName ,Department ,Salary) values (106,'Rahul','Kishav','Marketing',6000);

Select * from Employees2;

----Q.Retrieve the names and salaries of all employees earning more than $5000

select FirstName, LastName,Salary from Employees2 where Salary>5000;

----Q.Retrieve the count of employees in each department.

select Department,count(FirstName) as 'Count of employees'from employees2 group by Department ;

-----Update the salary of an employee with a specific EmployeeID.

update Employees2 set salary =9000 where EmployeeID = 106;

select * from Employees2;

---Delete a record from the Employees table based on a specific condition.

delete employees2 where EmployeeID =103;