Click here to Skip to main content
15,891,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am not very familiar to SQL
The following infomration are from my special homework.
I come here to ask some hints about SQL language


***The integrity rules are as following:
1.Each employee may be managed by one other employee
2.Each employee may manage one or more other employees
3.Each employee must work in a single department
4.Each department may be assigned one or more employees

Emp:
EmpNo Number(4)
Name Varchar2(10)
Job Varchar2(9)
Sal Number(7,2)
Comm Number(7,2)
HireDate Date
Mgr Number(4)
DeptNo Number(2)

Dept:
DeptNo Number(2)
Name Varchar2(14)
Location Varchar2(13)

What I have tried:

I have tried to make these information to relation schema and relation model. But its still difficult for me to transformt o SQL.
Posted
Comments
RedDk 13-Dec-16 11:18am    
Here in CPQA, start by showing some code ... like this:

USE [cpqaAnswers]
GO

CREATE TABLE [cpqaAnswers].[cpqa].[tbl_WC_sampleSimple_Emp](
EmpNo int,
Name nvarchar(10),
Job nvarchar(9),
Sal decimal(7,2),
Comm decimal(7,2),
HireDate Date,
Mgr int,
DeptNo int
)

CREATE TABLE [cpqaAnswers].[cpqa].[tbl_WC_sampleSimple_Dept](
DeptNo int,
Name nvarchar(14),
Location nvarchar(13)
)

SELECT [EmpNo]
,[Name]
,[Job]
,[Sal]
,[Comm]
,[HireDate]
,[Mgr]
,[DeptNo]
FROM [cpqaAnswers].[cpqa].[tbl_WC_sampleSimple_Emp]
GO



SELECT [DeptNo]
,[Name]
,[Location]
FROM [cpqaAnswers].[cpqa].[tbl_WC_sampleSimple_Dept]
GO

And you really need some data too. So that someone can see what it is you're proposing to do, knowing you think there's an answer to your problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900