SQL:
The schema name should be mxxws, where mxx is your MySQL user name. To refresh your memory – here is the schema for that database:
Create the rest of the contact management database by writing the statements that do each of the following items below. For each one: (1) execute them on your copy of the database, and (2) write the statements in the space:
Statement to create the Contact table (one statement)
Statement to create the Employee table (one statement)
Statement to create the ContactEmployee table (one statement):
CompanyID |
CompanyName |
Street |
City |
State |
Zip |
110 |
Urban Outfitters, Inc. |
5000 South Broad St. |
Philadelphia |
PA |
19112 |
111 |
Toll Brothers |
250 Gibraltar Rd. |
Horsham |
PA |
19044 |
ContactID |
CompanyID |
FirstName |
LastName |
Street |
City |
State |
Zip |
IsMain |
|
Phone |
501 |
110 |
Jack |
Lee |
4777 Cameron Rd. |
Buffalo |
NY |
14209 |
1 |
215-454-5500 |
|
502 |
111 |
Bonnie |
Johnson |
3600 Elk City Rd. |
Ridley Park |
PA |
19078 |
1 |
215-938-8000 |
EmployeeID |
FirstName |
LastName |
Salary |
HireDate |
JobTitle |
|
Phone |
1001 |
Dianne |
Connor |
85,000 |
August 12, 2011 |
Sales Manager |
215-555-5679 |
|
1002 |
Lesley |
Bloom |
70,000 |
July 1, 2012 |
Sales Representative |
215-555-5678 |
Contact:
Bonnie
Johnson |
Contact:
Jack
Lee |
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
This demonstration is using WAMP (Windows , Apache , MySQL and PHP) Server.Database and Tables are created using PHPMyAdmin.
NOTE : ALL SQL STATEMENTS WILL EXECUTES AS IT IS IN MySQL Workbench.
1.Table Name :Company
SQL Create table Statement :
Create TABLE Company (
CompanyID int primary key,
CompanyName varchar(100) ,
Street varchar(100),
City varchar(50),
State varchar(2),
Zip int not null
);
Inserting records into companty table :
INSERT INTO company values
(110,'Urban Outfitters, Inc.','5000 South Broad
St.','Philadelphia','PA',19112);
INSERT INTO company values (111,'Toll Brothers','250 Gibraltar
Rd.','Horsham','PA',19044);
Select records :
select * from company;
Screen in PHPMyAdmin :
*******************************
2.Table Name :
SQL Create table Statement :
CREATE TABLE contact(
ContactID int primary key,
CompanyID int ,
FirstName varchar(100),
LastName varchar(100),
Street varchar(100),
City varchar(10),
State varchar(2),
Zip int ,
IsMain TINYINT(1),
Email varchar(100),
Phone varchar(100),
foreign key(CompanyID) REFERENCES company (CompanyID)
);
Inserting records :
insert INTO contact values
(501,110,'Jack','Lee','4777 Cameron
Rd.','Buffalo','NY',14209,1,'[email protected]','215-454-5500');
insert INTO contact values (502,111,'Bonnie','Johnson','3600 Elk
City Rd.','Ridley
Park','PA',19078,1,'[email protected]','215-938-8000');
Selecting records :
select * from contact;
Screen in PHPMyAdmin :
*******************************
3.Table Name :
SQL Create table Statement :
CREATE TABLE Employee (
EmployeeID int PRIMARY KEY,
FirstName varchar(100),
LastName varchar(100),
Salary decimal(8,2),
HireDate date,
JobTitle varchar(100),
Email varchar(100),
Phone varchar(100)
);
Inserting records :
insert into Employee values
(1001,'Dianne','Connor',85000,'2011-12-8','Sales
Manager','[email protected]','215-555-5679');
insert into Employee values
(1002,'Lesley','Bloom',70000,'2012-07-1','Sales
Representative','[email protected]','215-555-5678');
Selecting records :
select * from Employee;
Screen in PHPMyAdmin :
*******************************
SQL Query :
update employee set phone=' 215-555-8800' where firstName='Lesley' and lastName='Bloom';
Screen in SSMS :
************************
SQL Query :
update company set companyName='Urban Outfitters' where companyName="Urban Outfitters, Inc.";
Screen in PHPMyADmin :
*****************************
SQL Query :
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
SQL: The schema name should be mxxws, where mxx is your MySQL user name. To refresh...
Using MySQL Workbench: Submit the printouts of your interaction with the DBMS. ID name ID delivery_timestamp supplier supplied item city name quantity 1. [30-point] Create an SQL database of the above ER-diagram using "create table” statements. The type of attribute "quantity" is integer, "delivery_timestamp" is timestamp, and, for all the others, the type is varchar (up to 100 chars). 2. [10-point] Insert 4 records into supplier, 4 records into item, and 10 records into supplied. 3. [60-points] Perform the following...
For this set of Review Questions, we will create and use a database for the Wedgewood Pacific Corporation (WPC) that is similar to the Microsoft Access database we created and used in Chapters 1 and 2. Founded in 1957 in Seattle, Washington, WPC has grown into an internationally recognized organization. The company is located in two buildings. One building houses the Administration, Accounting, Finance, and Human Resources departments, and the second houses the Production, Marketing, and Information Systems departments. The...
Sample data for these tables are shown in Figures 3-26 and 3-27. For each SQL statement you write, show the results based on these data. If possible, run the statements you write for the questions that follow in an actual DBMS, as appropriate, to obtain results. Use data types that are consistent with the DBMS you are using. If you are not using an actual DBMS, consistently represent data types by using either the MySQL, Microsoft SQL Server, or Oracle...
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...
Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...
I need the SQL statements for these questions: 6. List the reservation IDs for reservations that are for a paddling trip. (Hint: Use a subquery.) 7. What is the longest distance for a biking trip? 8. For each trip in the RESERVATION table that has more than one reservation, group by trip ID and sum the trip price. (Hint: Use the COUNT function and a HAVING clause.) 9. How many current reservations does Colonial Adventure Tours have and what is...
Create three or more MySQL Data Control language (DCL) Statements using the Youth League Database. 1. A Create new user statement for the database 2. A statement that grants privileges to the new user 3. A statement that revokes privileges 1. A SQL Text File containing the SQL commands to create the database, create the table, and insert the sample test data into the table. 2. A SQL Text File containing the DCL SQL Statements. eted hemas Untitled Limit to...
Connect to mySQL DBMS, open a SQL script file, navigate to CityJail.sql file and execute it to create tables and populate with the supplied data. If there are any errors in the script fix them. It is your job to find the errors and correct them. This is important. You will need correct data for future exercises in this module. Then answer all questions. Write the answer below each question then take screen shot of the result. This script builds...
SQL: CREATE STATEMENT For patients whose last name matches the name entered by the user, display their first name, phone number, and doctor's name. Note: Try Davis. (TEXT FOR DATABASE BELOW) DROP TABLE PATIENT; DROP TABLE BILLING; DROP TABLE DOCTOR; CREATE TABLE DOCTOR( DOC_ID VARCHAR2(10) NOT NULL, DOC_NAME VARCHAR2(20), DATEHIRED DATE, SALPERMON NUMBER(8), AREA VARCHAR2(20), SUPERVISOR_ID NUMBER(8), CHGPERAPPT NUMBER(8), ANNUAL_BONUS NUMBER(8), PRIMARY KEY (DOC_ID) ); INSERT INTO DOCTOR VALUES('432', 'Harrison', to_date('05-DEC-1994','dd-mon-yyyy'), 12000, 'Pediatrics', 100, 75, 4500); INSERT INTO DOCTOR VALUES('509',...
Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...