Question

Using DDL (data definition language) statement(create table statement) to define each relation schema, i.e., giving the...

Using DDL (data definition language) statement(create table statement) to define each relation schema, i.e., giving the create table statement for each relation schema with the definition of primary key in each table.

Each employee has a name, social security number (primary key), gender, age, and salary. Each employee works for only one department, and there are more

than one employee working in a department. Each department has a department name, a department number (pk), and a department location.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CREATE table department(dname varchar(255),dno int,dloc varchar(255),PRIMARY KEY(dno));

CREATE table emp(name varchar(255),social_security_no int(255),gender char,age int,salary int,PRIMARY KEY(social_security_no),dno int,FOREIGN KEY(dno) REFERENCES department(dno));

Add a comment
Know the answer?
Add Answer to:
Using DDL (data definition language) statement(create table statement) to define each relation schema, i.e., giving the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4 Consider the following relational schema, DDL statements and tables: EMPLOYEE( EmployeeID, EmployeeName, SupervisorID, DepartmentID) PROJECT...

    4 Consider the following relational schema, DDL statements and tables: EMPLOYEE( EmployeeID, EmployeeName, SupervisorID, DepartmentID) PROJECT (ProjectID, EmployeeID) DEPARTMENT( Department ID, DepartmentName) CREATE TABLE EMPLOYEE ( EmployeeID          INT           PRIMARY KEY,    EmployeeName   VARCHAR(50)      NOT NULL,    SupervisorID INT DEFAULT 9,    DepartmentID   INT,    FOREIGN KEY (SupervisorID) REFERENCES EMPLOYEE (EmployeeID)    ON DELETE SET DEFAULT   ),    FOREIGN KEY (DepartmentID) REFERENCES DEPARTMENT(DepartmentID)    ON UPDATE SET NULL); CREATE TABLE PROJECT ( ProjectID    INT          PRIMARY KEY, EmployeeID INT DEFAULT 9, FOREIGN...

  • -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),    ...

    -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),     city varchar(15),     constraint customer_pk         primary key (cid) ); create table Club (     club varchar(15) not null,     desc varchar(50),     constraint club_pk         primary key (club) ); create table Member (     club varchar(15) not null,     cid   smallint     not null,     constraint member_pk         primary key (club, cid),     constraint mem_fk_club         foreign key (club) references Club,     constraint mem_fk_cust...

  • Answer each of the following questions. The questions are based on the following relational schema: Emp(*eid:...

    Answer each of the following questions. The questions are based on the following relational schema: Emp(*eid: integer¬, ename: string, age: integer, salary: decimal, doj: date) Works(*eid: integer, *did: integer, no_of_hours: integer) Dept(*did: integer, dname: string, budget: real, managerid: integer) a) Give an example of a foreign key constraint that involves the Dept relation. b) What are the options for enforcing this constraint when a user attempts to delete a Dept tuple? c) Define the Dept relation in SQL so that...

  • create relational schema

    Create the relational schema.Professors have a Social Security Number, a name, an age, a rank, and a research specialty.Projects have a project number, a sponsor name, a starting date, an ending date, and a budget.Graduate students have Social Security Number, a name, an age, and a degree program (e.g., M.S. Or Ph.D.).Each project is managed by one professor (known as the project’s principal investigator).Each project is worked on by one or more professors (known as the project’s co-investigators).Professors can manage...

  • Part I. Mapping an (E)ER schema to a relational database schema (46 points) NOTE o Each...

    Part I. Mapping an (E)ER schema to a relational database schema (46 points) NOTE o Each relation sachem should have a primary key (PK) when you answer. • To present the reference table of the foreign key (e.g., FK, FK1, K2), use an arrow. Do not use the relationship cardinality symbols of crow's foot notation in the relational database schema. o It is not required to specify the domain constraint (e.g., data type and length) of each attribute. 1. (12...

  • Given the bsg_planets table created by using the following definition query : -- CREATE TABLE `bsg_planets`...

    Given the bsg_planets table created by using the following definition query : -- CREATE TABLE `bsg_planets` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `population` bigint(20) DEFAULT NULL, `language` varchar(255) DEFAULT NULL, `capital` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Insert information about the planet Mars which has a population of 2,  language as "Binary" and "Olympus Mons" as Capital, in bsg_planets. Then list the row(s), with all the information for that...

  • 1. {90 points} Your task is to design a 'Company database capable of storing information about...

    1. {90 points} Your task is to design a 'Company database capable of storing information about EM- PLOYEE(S), DEPARTMENT(s), and PROJECT(s). Knowing that: We store each employee's name composite attribute - {10 points}), social security number, address, salary, and telephone number. An employee is assigned to one department, but may work on several projects which are not necessarily controlled by the same department. We keep track of the number of hours that an employee works on each project - {10...

  • Help In Database: Next comes the data entry: Make up data for your database, or find...

    Help In Database: Next comes the data entry: Make up data for your database, or find real data. You can enter the data with INSERT statements, but it is much easier to use PhpAdmin. It has a form where you can type the data directly. Alternatively, you can use PhpAdmin to import CSV data (comma-separated values), which you can export from Excel. Include at least 3 rows in each of the entity relations, and as many rows as you need...

  • Problem 1 (25 points) Consider the following database schema: Employee (fname, Iname, ssn, address, salary, mgrssn,...

    Problem 1 (25 points) Consider the following database schema: Employee (fname, Iname, ssn, address, salary, mgrssn, dnumber) Department (dname, dnumber, mgrssn, mngrstartdate) Project (pname, pnumber, plocation, dnumber) Works_On (ssn, pnumber, hours_per_week) Dependent (ssn, dependent name, bdate, relationship) The above relations store information about a company. The meaning of most of the relations and attributes is straightforward. For example, the first relation stores information about employees. The mgrssn is the SSN of the manager (supervisor) of the given employee. A manager...

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT