Questions/answers about dbms.
Code:
create database tab;
use tab;
create table tab(name nvarchar(100),id int,city nvarchar(100),msalry int)
insert into tab(name,id,city,msalry)
values('kashan',1,'samundi',500),
('zunair',2,'karachi',5000),
('sharoon',3,'multan',100),
('Mirza',4,'pindi',3000),
('Ahtisham',5,'multan',45),
('musadiq',6,'islamabad',6000),
('wahab',7,'pindi',450),
('ahsan',8,'lahore',100),
('bilal',9,'sialkot',5000),
('ahmed',10,'lahore',1200)
select *from tab
select name from tab
where name like 'a%d'
select name from tab
where city='lahore' or city='multan'
select sum(msalry) as total from tab
select city, SUM(msalry) FROM tab
GROUP BY city;
select count (*) as [table] from tab
Populate 10 rows using Insert Command.
Write a query to show the name of students whose name
start with ‘a’ and ends with ‘d’.
Write a query to show the name of students whose cities
are Lahore or Multan.
Write a query to show the sum of monthly salary of
employees.
Write a query to show the sum of monthly salary of
employees by city.
Write a query to show the count of number of employees.
0 Comments