SQL_chapter1_assignment
--1.Find out the selling cost AVG for packages developed in Pascal.
Select AVG(SCOST) as [Average selling cost] From SOFTWARE Where DEVELOPIN='PASCAL';
--2.Display Names, Ages of all Programmers.
select pname as Names, DATEDIFF(YY,[DOB],GETDATE()) as [Age] from programmer;
--3.Display the Names of those who have done the DAP Course.
Select PNAME as Names, COURSE from STUDIES where COURSE = 'DAP';
--4.Display the Names and Date of Births of all Programmers Born in January.
Select PNAME as Names,DOB, DATENAME(MM, DOB) as [Month] from PROGRAMMER where DATENAME(MM, DOB) = 'January'
--5.Display the Details of the Software Developed by Ramesh
select * from SOFTWARE where PNAME='Ramesh'
--6. Display the Details of Packages for which Development Cost have been recovered.
select * , (SCOST*SOLD) as [Total Sale] from SOFTWARE where (SCOST*SOLD) > DCOST
--7. Display the details of the Programmers Knowing C
select pname from PROGRAMMER where PROF1='C' or PROF2='C'
--8. What are the Languages studied by Male Programmers?
Select Distinct PROF1 as'Languages studied by Male Programmers' From Programmer
where GENDER='M'
UNION
Select Distinct PROF2 as'Languages studied by Male Programmers' From Programmer
where GENDER='M'
--9. Display the details of the Programmers who joined before 1990
SELECT PNAME as Names, DOJ FROM PROGRAMMER WHERE DATENAME(YY, DOJ)<1990
--10.
Who are the authors of the Packages, which have recovered more than double the Development cost?
select distinct pname as authors from software where (SCOST*SOLD)>(DCOST*2);
Comments
Post a Comment