Skip to main content

SQL Practical Question




Create table “EMP” as per the following specification:
COLUMN NAME
DATATYPE
SIZE
CONSTRAINTS
Emp_No
Integer
4
Primary Key
Emp_Name
Varchar2
20
Not Null
Job
Varchar2
10

Hiredate
Date
dd-mm-yyyy

Salary
Float
10,2
Salary>10000
Commission
Integer
4

DeptNo
Integer
2
10,20 or 30

Job Types are:
·         President
·         Manager
·         Clerk
·         Salesman
Commission given only to ‘salesman’.
QUESTIONS
1)      Create the above table including its constraints.
2)      Insert 10 records into it.
3)      Display the name , job, salary of all employee having salary between 15000 and 25000
4)      Display the employee name , department and total salary calculated as (Salary +comm.) for all employees.
5)      Display the content of the table in the descending order of salary and ascending order of name.
6)      Display Emp_no , Emp_Name, annual salary under the heading “ANNUAL SALARY” where salary is calculated as (salary + commissim*12)
7)      Display the maximum salary from the table department wise.
8)      Display the name and job of all the employees whose name starts with ‘A’ and ends with ‘A’.
9)      Display the name i.e. Emp_Name, job and hiredate of the employee having job as manager, salesman or clerk.
10)   Count the no. of employee having salary greater than 15000.
11)   Create view DEPT20 with Emp_No, Emp_Name and salary of employee for department no. 20.
12)   To display the information of all the employees who were hired during year 1995.
13)   Show the average salary for all the departments with more than three people for a job.
14)   Write a SQL command to add the column named as remark with datatype variable length string (Varchar(20)).

15)   Increase the salary of all employees by 20% who were hired before 1st Jan 1995 and belongs to job “ANALYST”.

Popular posts from this blog

Project Work for Class XII Informatics Practices (065) - CBSE 2020-2021

  Marks  allotted : 05 Marks A. PROJECT GUIDELINES The aim of the class project is to create tangible and useful IT application. The learner may identify a real-world problem by exploring the environment. e.g. Students can visit shops/business places, communities or other organizations in their localities and enquire about functioning of the organization, and how data are generated, stored, and managed. The learner can take data stored in csv or database file and analyze using Python libraries and generate appropriate charts to visualize. If an organization is maintaining data offline, then the learner should create a database using MySQL and store the data in tables. Data can be imported in Pandas for analysis and visualization. Learners can use Python libraries of their choice to develop software for their school or any other social good. Learners should avoid plagiarism and violation of copyright issues while working on projects. Any resources (data, image etc.) used in t...

Assignments - XII Computer Science

POINTERS ASSIGNMENT Assignment Date: 09/09/15 Submission Date: 14/09/15 Q1. What will be the output of the following program: int main() { int x [ ] = { 50, 40, 30, 20, 10}: int *p, *t; p = x; t = x + 1; cout << *p << “,” << *t++; return 0; } Q2. What will be the output of the program( Assume all necessary header files are included) void print (char * p ) { p = "Comp"; cout<<"value is "<<p<<endl; } int main( ) { char * x = "Class XII"; print(x); cout<<"new value is "<<x<<endl; return 0; } Q3. Identify errors on the following code segment, and underline the error. float c[ ] ={ 1.2,2.2,3.2,56.2}; float *k,*g; k=c; g=k+4; k=k*2; g=g/2; cout<<”*k=”<<*k<<”*g=”<<*g; Q4. Write the output of the following program. void print (char * p ) { p = "Comp"; cout<<"valu...