Preview

supply chain management at wal mart case study ivey professor P.Fraser

Powerful Essays
Open Document
Open Document
3961 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
supply chain management at wal mart case study ivey professor P.Fraser
Data Definition, Constraints, and Schema Changes

CREATE TABLE
-Specifies a new base relation by giving it a name, and specifying each of its attributes and their data types (INTEGER, FLOAT, DECIMAL(i,j), CHAR(n), VARCHAR(n))
- A constraint NOT NULL may be specified on an attribute

CREATE TABLE DEPARTMENT
( DNAME VARCHAR(10) NOT NULL,
DNUMBER INTEGER NOT NULL,
MGRSSN CHAR(9),
MGRSTARTDATE CHAR(9) );
- In SQL2, can use the CREATE TABLE command for specifying the primary key attributes, secondary keys, and referential integrity constraints (foreign keys).
- Key attributes can be specified via the PRIMARY KEY and UNIQUE phrases

CREATE TABLE DEPT
( DNAME VARCHAR(10) NOT NULL,
DNUMBER INTEGER NOT NULL,
MGRSSN CHAR(9),
MGRSTARTDATE CHAR(9),
PRIMARY KEY (DNUMBER),
UNIQUE (DNAME),
FOREIGN KEY (MGRSSN) REFERENCES EMP );

DROP TABLE

- Used to remove a relation (base table) and its definition
- The relation can no longer be used in queries, updates, or any other commands since its description no longer exists
-Example:
DROP TABLE DEPENDENT;

ALTER TABLE

- Used to add an attribute to one of the base relations
- The new attribute will have NULLs in all the tuples of the relation right after the command is executed; hence, the NOT NULL constraint is not allowed for such an attribute
- Example:

ALTER TABLE EMPLOYEE ADD JOB VARCHAR(12);

- The database users must still enter a value for the new attribute JOB for each EMPLOYEE tuple. This can be done using the UPDATE command.

Features Added in SQL2 and SQL-99

CREATE SCHEMA

Specifies a new database schema by giving it a name.

REFERENTIAL INTEGRITY OPTIONS

- We can specify RESTRICT, CASCADE, SET NULL or SET DEFAULT on referential integrity constraints (foreign keys)

CREATE TABLE DEPT
( DNAME VARCHAR(10) NOT NULL,
DNUMBER INTEGER NOT NULL,
MGRSSN CHAR(9),
MGRSTARTDATE CHAR(9),
PRIMARY KEY (DNUMBER),
UNIQUE (DNAME),
FOREIGN KEY (MGRSSN) REFERENCES EMP

You May Also Find These Documents Helpful

  • Satisfactory Essays

    PT2520 Unit7Labs Tramil

    • 330 Words
    • 1 Page

    13. What is referential integrity? Exists when every foreign key relates to an existing primary key. There are no orphan records in child tables that have no reference in a parent table.…

    • 330 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    Referential Integrity exists when every foreign key relates to an existing primary key. There are no orphan records in child tables that have no reference in a parent table.…

    • 327 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    7) In a one-to-many relationship, each row on in the primary key table can be related to any number of rows in the foreign key or child table.…

    • 613 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    a guide to mysql ch 7

    • 1287 Words
    • 9 Pages

    During the CREATE TABLE command, but can be modified using the ADD PRIMARY KEY command…

    • 1287 Words
    • 9 Pages
    Powerful Essays
  • Powerful Essays

    b) You are to clearly mark Primary and Foreign Keys as shown in the sample below:…

    • 1494 Words
    • 19 Pages
    Powerful Essays
  • Good Essays

    07

    • 4772 Words
    • 25 Pages

    1) The SQL CREATE TABLE statement is used to name a new table and describe the table's columns.…

    • 4772 Words
    • 25 Pages
    Good Essays
  • Satisfactory Essays

    04

    • 4586 Words
    • 34 Pages

    A PRIMARY KEY constraint will make certain the column designated as the primary key does not contain a NULL value.…

    • 4586 Words
    • 34 Pages
    Satisfactory Essays
  • Good Essays

    As explained earlier in this document, the entities and attributes were already created by Smith’s Systems Consulting, but gave no details on how they would be used in the database. In order to fully explain how the entities and…

    • 728 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Erd Explanation

    • 260 Words
    • 2 Pages

    • Create relationships between these new tables and their predecessors through the use of foreign keys.…

    • 260 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    IST223-GHW7FS13

    • 2215 Words
    • 9 Pages

    State relationships as implied by foreign keys and specify the maximum and minimum cardinality of each relationship. Justify your…

    • 2215 Words
    • 9 Pages
    Powerful Essays
  • Good Essays

    Normalization to Database

    • 714 Words
    • 3 Pages

    3. All attributes in a table are dependent on the primary key and nothing but the primary key.…

    • 714 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Primary Key

    • 438 Words
    • 3 Pages

    2. For each of the entities identified, design tables and identify the possible candidate keys,…

    • 438 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    In an organization such as Wal-Mart that has a decentralized management team it needs HRM professionals to create uniform guidelines that the whole company will follow. By implementing standards and methods they will be able to document the reasons that the people received promotions and raises while also showing the reasons that others did not. A few of the standards that they need to look at are the amount of time that the employee has been with the company and their job performance in their position.…

    • 419 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    My Sql

    • 1999 Words
    • 8 Pages

    This query will create a table create table furniture ( no int(6) NOT NULL PRIMARY KEY, itemname varchar(20) default NULL, type varchar(10) default NULL, dateofstock date default NULL, price decimal(6,0), discount int(2) ); Query OK, 0 rows affected (0.22 sec) This query will create a table create table arrival ( no int(6) NOT NULL PRIMARY KEY, itemname varchar(20) default NULL, type varchar(20) default NULL, dateofstock date default NULL, price int(6) default NULL, discount int(2) ); Query OK, 0 rows affected (0.22 sec) mysql> desc furniture; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+ | no | int(6) | NO | PRI | NULL | | | itemname | varchar(20) | YES | | NULL | | | type | varchar(10) | YES | | NULL | | | dateofstock | date | YES | | NULL | | | price | decimal(6,0) | YES | | NULL | | | discount | int(2) | YES | | NULL | | +-------------+--------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) inserting values into the table furniture and arrival insert into furniture values(1,"white lotus","double Bed","2002/02/23",30000,25); insert into furniture values(2,"Pink Feather","Baby cot","2002/01/20",7000,20); insert into furniture values(3,"Dolphine","Baby cot","2002/02/19",9500,20); insert into furniture values(4,"Decent","Office Table","2002/01/01",25000,30); insert into furniture values(5,"Comfort Zone","Double Bed","2002/01/12",25000,25); insert into furniture values(6,"Donald","Baby cot","2002/01/12",6500,15); insert into furniture values(7,"Royal Finish","office Table","2002/10/20",18000,25); insert into furniture values(8,"Royal Tiger","Sofa","2002/03/22",31000,25); insert into furniture…

    • 1999 Words
    • 8 Pages
    Satisfactory Essays
  • Powerful Essays

    A relation is a two-dimensional table in which (1) the entries in the table are single-valued; (2) each column has a distinct name; (3) all of the values in a column are values of the same attribute; (4) the order of the columns is immaterial; (5) each row is distinct; and (6) the order of the rows is immaterial.…

    • 2147 Words
    • 9 Pages
    Powerful Essays