Showing posts with label sql queries. Show all posts
Showing posts with label sql queries. Show all posts

Monday, 15 April 2013

SQL Server Queries for Practice


Written By:- Isha Malhotra

Our Website:-Tech Altum

45 SQL Server  Queries for practice(21-45)- Part 2 

Create the Following Tables
1.       EmpReg
Column Name
Data type
Is Null
Constraints
EmpId
Int
No
Primary key
EmpName
Varchar(100)
No
it can not be blank
Gender
Varchar(10)
No
It can not be blank
DeptId
Int
No
Depends on the table dept with column Id
Phone
Varchar(100)
Yes

Mobile
Varchar(100)
No
Should be unique
Email
Varchar(100)
no
Should be unique
Country
Int
No
Depends on table country with column cid
state
Int
no
Depends on table country with column sid
Salary
Varchar(100)
No
Should be between 5000 to 15000
DateOfJoining
datetime
no






Saturday, 13 April 2013

SQL Server Queries for Practice


Written By:- Isha Malhotra
Our Website:-Tech Altum

45 SQL Server Queries for Practice (1-20) - Part 1


Following is the Employee Table which contains the detail for the Employee with department id and head id. Head of the employee is also an another employee
Table:-Employee
EmpId
EmpName
Department
ContactNo
EmailId
EmpHeadId
101
Isha
E-101
1234567890
abc@yahoo.com
105
102
Priya
E-104
1234567890
abc@gmail.com
103
103
Neha
E-101
1234567890
abc@gmail.com
101
104
Rahul
E-102
1234567890
abc@ymail.com
105
105
abhishek
E-101
1234567890
abc@gmail.com
102

Table:-EmpDept
DeptId
DeptName
DeptHead
E-101
HR
105
E-102
Development
101
E-103
House Keeping

E-104
sales
104
E-105
purchase
104