Words of Wisdom:

"Evil is not bad, just missunderstood" - Tom Felton" - Msgg

Sql Codes

  • Date Submitted: 12/13/2011 12:19 PM
  • Flesch-Kincaid Score: 76.8 
  • Words: 1002
  • Essay Grade: no grades
  • Report this Essay
a. Write SQL statement to create   an authors table.
AUTHORS TABLE
COLUMN     DATATYPE               SIZE                                       CONSTRAINTS
AUTH_ID NUMERIC                 5 NOT NULL
FNAME VARCHAR                 25 NOT NULL
LNAME VARCHAR                 35
ADDR VARCHAR                 50
CITY VARCHAR               25
STATE VARCHAR                 2
ZIP VARCHAR                 5
PHONE VARCHAR                 12 NOT NULL DEFAULT   0

CREATE TABLE AUTHORS   (AUTH_ID NUMERIC(5) NOT NULL, FNAME VARCHAR(25) NOT NULL, LNAME VARCHAR(35), ADDR VARCHAR(50), CITY VARCHAR(25), STATE VARCHAR(2), ZIP VARCHAR(5), PHONE VARCHAR(12) NOT NULL DEFAULT   0);

b. Write SQL statement to add primary key to the authors table ( you select the primary key)
ALTER TABLE AUTHORS ADD PRIMARY KEY (AUTH_ID);
c. Write   SQL Statements to insert the following data into the authors table:

ID           First name       Last Name Address           City           State       Zip Phone
00001 Mary Smith 4 James Way New York NY 11222 333-222-1111
00002 James Marshall 71 west street Philadelphia PA 22442
00004 Julio Uncle 883 Green St New Bern NC 09991 440-990-3324
00006 HENRY Seven 889 James Mass New York NY 11223 889-990-3311
00510 TORIS TEN 992 Red way Columbus OH 89322 778-440-3331
00780 Dobbins James 8 Black Seal St New York NY 11222 333-221-2234


INSERT INTO AUTHORS VALUES (00001, ‘Mary’, ‘Smith’, ‘4 James Way’, ‘New York’, ‘NY’, ‘11222’, ‘333-222-1111’);
INSERT INTO AUTHORS VALUES (00002, ‘James’, ‘Marshall’, ‘71 west street’, ‘Philadelphia’, ‘PA’, ‘22442’, NULL);
INSERT INTO AUTHORS VALUES (00004, ‘Julio’, ‘Uncle’, ‘883 Green St’, ‘New Bern’, ‘NC’, ‘09991’, ‘440-990-3324’);
INSERT INTO AUTHORS VALUES (00006, ‘HENRY’, ‘Seven’, ‘889 James Mass’, ‘New York’, ‘NY’, ‘11223’, ‘889-990-3311’);
INSERT INTO AUTHORS VALUES (00510, ‘TORIS’, ‘TEN’, ‘992 Red way’, ‘Columbus’, ‘OH’, ‘89322’, ‘778-440-3331’);
INSERT INTO AUTHORS VALUES (00780,...

Comments

Express your owns thoughts and ideas on this essay by writing a grade and/or critique.

  1. No comments