quiz1_-Solution - NAME(Arabic Section TANTA UNIVERSITY FACULTY OF ENGINEERING COMPUTER AND CONTROL DEPARTMENT 3RD GRADE DATABASE SYSTEMS QUIZ 1 1 Write

quiz1_-Solution - NAME(Arabic Section TANTA UNIVERSITY...

This preview shows page 1 - 2 out of 2 pages.

NAME(Arabic) Section TANTA UNIVERSITY FACULTY OF ENGINEERING COMPUTER AND CONTROL DEPARTMENT 3 RD GRADE - DATABASE SYSTEMS - QUIZ 1 1. Write down the query to create employee table with Identity column ([EmployeeID]) CREATE TABLE EmployeeDetail( [EmployeeID] INT IDENTITY(1,1) NOT NULL, [FirstName] NVARCHAR(50) NULL, [LastName] NVARCHAR(50) NULL, [Salary] DECIMAL(10, 2) NULL, [JoiningDate] DATETIME NULL, [Department] NVARCHAR(20) NULL, [Gender] VARCHAR(10) NULL ) 2. How to set foreignkey relationship using query(set EmployeeID column of ProjectDetail table as a foreignkey) ALTER TABLE ProjectDetail ADD CONSTRAINT fk_EmployeeDetailID_Eid FOREIGN KEY(EmployeeDetailID)REFERENCES EmployeeDetail(EmployeeID) 3.Write a query to get only "FirstName" column from "EmployeeDetail" table 4. Select employee detail whose name is "Vikas" and whose "FirstName" start with latter 'a'. SELECT * FROM [EmployeeDetail] WHERE FirstName = 'Vikas' or firstName like ‘a%’ 5. Get all employee details from EmployeeDetail table whose "FirstName" contains 'k' SELECT * FROM [EmployeeDetail] WHERE FirstName like ‘ %k %’
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Spring '16
  • mohamed attia
  • ASCII, Articles with example SQL code, Join, SQL keywords

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes