SlideShare une entreprise Scribd logo
1  sur  4
SOLUTIONJUG.COM
CIS/336 iLab 3 of 7 - SQL Course
CLICK HERE TO GET THE SOLUTION !!!!!!!!
Beginning with this lab, and continuing through the remaining weeks you will be doing all of your
work in Oracle itself. The editor interface to the Oracle server is SQL*Plus, and by now you have
received your logon ID and password and should have at least made sure you can connect. If for
any reason you have not done so, please do so now before continuing any further. If for any reason
you cannot connect then you need to let the instructor know ASAP so that any problems can be
resolved.
Before attempting Lab #3, you need to be sure you have read through the SQL*Plus tutorial which
can be found in Doc Sharing as well as under the SQL*Plus Tutorial tab in Week 3. This tutorial
describes the functionality of the editor and will take you through the process of setting up and
using the SQL*Plus in the iLab environment so that it will best serve your needs for the remainder of
the labs required for this course.
The lab for this week addresses taking a logical database design (data model) and now transforming
that into a physical model (tables, constraints, and relationships). As part of the lab, you will need to
download the Zip file titled "Lab 3 Support Documents" from Doc Sharing. This Zip file contains
three documents: Lab 3 Relationship Diagram.docx, Lab 3 Meta Data Diagram.xlsx, and Lab 3 Input
Data.docx.
Your job will be to take the meta data defined in the data dictionary spreadsheet document, and
using the relationship diagram as a guide define the table structures and constraints using both
CREATE TABLE and ALTER TABLE statements. Once this has been done, you will need to write the
INSERT INTO TABLE statements to insert the data provided into the table. The data should verify
that the constraints you have created are valid and define the correct referential and data integrity
constraints asked for. Lastly, you will write SELECT statements to query the tables and verify the
data was populated.
Narrative/Case Study
For this lab, you be working with command-line SQL to build a series of relational tables, using SQL
CREATE statements in a script file format for the Student Database and then populate those tables
through the use of INSERT statements with sample data.
You will need to create a script file and name it YourName_Lab3.txt containing the following
code:
The drop table statements listed later in the specifications of this lab.
The CREATE TABLE statements required to build the seven (7) tables.
The INSERT statements necessary to insert all of the sample data.
Seven select statements to verify that the data is in the tables and accessible.
To help you accomplish this task successfully, you are being supplied with the following three
documents which can be found in the Doc Sharing tab on the course website:
A Relationship Diagram of the database showing in graphical form the 1:M relationships between
the tables (336_Lab3_Relationship_Diagram.doc).
A Meta Data chart providing information about table names, column names, etc. Be sure to follow
this reference exactly when constructing your CREATE TABLE statements (336_Lab3_Data_Dict.xls).
A listing of sample data to use when writing the INSERT statements to populate the tables
(336_lab3_input_data.doc).
The following guidelines are being provided to help assist you in creating your script file:
Create the tables in the order shown in the data dictionary. Use the names for the tables and
columns as listed in the Meta Data chart – Do not change them as it will affect your grade.
Creating CONTRAINTS -
Create all constraints as indicated in the data dictionary.
Constraint suffixes must be as follows:
Primary key constraint – PK
Foreign key constraint – FK
Check constraint - CC
Explicitly name all constraints PRIMARY KEY, FOREIGN KEY, and CHECK constraints to reflect:
TableName_ColumnName_ConstraintSuffix (For example, to name a PRIMARY KEY constraint on the
SID column in the student table you would use STUDENT_SID_PK.)
For this lab you do not have to explicitly name NOT NULL constraints
Create all PRIMARY KEY and NOT NULL constraints within the CREATE TABLE statements at the
column level (line level), unless the Primary Key is a composite Primary Key (yes, there is one).
Composite Primary Key constraints must be created at the table level. Create all FOREIGN KEY and
CHECK constraints at the table level using ALTER TABLE statements. All constraints must be added
prior to populating the tables with data. Create all of the tables and all of the constraints before
populating any of the tables with data. Insert statements must be in the same order as the tables
are created (follow the order in the sample data file). ALL character strings must be enclosed in
single quotes. This includes alpha strings and alphanumeric (remember that any formatting within a
numeric strings makes it alphanumeric). If you are inserting a NULL, do not enclose the word NULL
in single quotes, as this will insert the word NULL into the row. To insert a null you simply use the
word NULL.
Deliverables
The deliverable for this lab will include the following documents.
Your script file. Create this file in Notepad not Word. Make sure your name is in a comment area at
the top of the script file. Use a double dash to create a one line comment:
--Jacob Smith
--Lab 3
Your lab output file created using a spool session in SQL*Plus.
Be sure to use the SET ECHO ON session command when creating the output file so that both the
SQL commands and results will show in the output. Be sure your name is on all documents and that
all documents have been included in a single Zip file for this week’s assignments.
L A B S T E P S
STEP 1: The DROP statements
The following DROP TABLE statements must appear at the top of your script file. This will allow you
to run and re-run your script file as often as you need to. The first time you run your script file you
will get an ERROR on the drop statements saying the Table or View does not exist. This is true since
it has not been created yet, but the error is more informational than anything. Once the tables are
created, you will not get this error again.
DROP TABLE ENROLLMENT CASCADE CONSTRAINTS PURGE;
DROP TABLE COURSE_SECTION CASCADE CONSTRAINTS PURGE;
DROP TABLE COURSE CASCADE CONSTRAINTS PURGE;
DROP TABLE TERM CASCADE CONSTRAINTS PURGE;
DROP TABLE STUDENT CASCADE CONSTRAINTS PURGE;
DROP TABLE FACULTY CASCADE CONSTRAINTS PURGE;
DROP TABLE LOCATION CASCADE CONSTRAINTS PURGE;
STEP 2: The CREATE TABLE statements
Next, define the CREATE TABLE statements for the seven tables that you are to create based upon
the ERD and Data Dictionary that you have been given for this lab. Be sure to follow the guidelines
given above on how and where to create the different types of constraints for each table.
STEP 3: The INSERT statements for the data
The third step is to create the insert statements to insert the sample data into the tables created in
Step 2. You might find it helpful to take the Word document containing the sample data and save it
as a text file. After doing this, you could create the insert statements around the actual data that is
in that file. The process for doing this should have been covered in one of the lectures for this unit.
If it was not, then ask your instructor to discuss this process with the class.
STEP 4: The SELECT statements
The next step of the lab will be to create the select statements to verify the data was inserted
correctly. You should have seven select statements; one for each table. The command is SELECT *
FROM Table_Name; For example, to select all columns from the Student table, the command would
be SELECT * FROM Student;
Be sure to save all of the above statements in your script file.
STEP 5: Testing and verifying your script
Now we come to the point of verifying that your script file works by creating all of the tables and
inserting all of the data. To verify this you will need to execute your saved script file and create an
output file to capture the results being returned to the session by using the spool COMMAND
outlined in the tutorial "Using Oracle SQL*Plus." This output file will be one of the files you will be
turning in for grading.
CLICK HERE TO GET THE SOLUTION !!!!!!!!

Contenu connexe

Dernier

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Dernier (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Cis 336 i lab 3 of 7

  • 1. SOLUTIONJUG.COM CIS/336 iLab 3 of 7 - SQL Course CLICK HERE TO GET THE SOLUTION !!!!!!!! Beginning with this lab, and continuing through the remaining weeks you will be doing all of your work in Oracle itself. The editor interface to the Oracle server is SQL*Plus, and by now you have received your logon ID and password and should have at least made sure you can connect. If for any reason you have not done so, please do so now before continuing any further. If for any reason you cannot connect then you need to let the instructor know ASAP so that any problems can be resolved. Before attempting Lab #3, you need to be sure you have read through the SQL*Plus tutorial which can be found in Doc Sharing as well as under the SQL*Plus Tutorial tab in Week 3. This tutorial describes the functionality of the editor and will take you through the process of setting up and using the SQL*Plus in the iLab environment so that it will best serve your needs for the remainder of the labs required for this course. The lab for this week addresses taking a logical database design (data model) and now transforming that into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the Zip file titled "Lab 3 Support Documents" from Doc Sharing. This Zip file contains three documents: Lab 3 Relationship Diagram.docx, Lab 3 Meta Data Diagram.xlsx, and Lab 3 Input Data.docx. Your job will be to take the meta data defined in the data dictionary spreadsheet document, and using the relationship diagram as a guide define the table structures and constraints using both CREATE TABLE and ALTER TABLE statements. Once this has been done, you will need to write the INSERT INTO TABLE statements to insert the data provided into the table. The data should verify that the constraints you have created are valid and define the correct referential and data integrity constraints asked for. Lastly, you will write SELECT statements to query the tables and verify the data was populated. Narrative/Case Study For this lab, you be working with command-line SQL to build a series of relational tables, using SQL CREATE statements in a script file format for the Student Database and then populate those tables through the use of INSERT statements with sample data. You will need to create a script file and name it YourName_Lab3.txt containing the following code: The drop table statements listed later in the specifications of this lab. The CREATE TABLE statements required to build the seven (7) tables. The INSERT statements necessary to insert all of the sample data.
  • 2. Seven select statements to verify that the data is in the tables and accessible. To help you accomplish this task successfully, you are being supplied with the following three documents which can be found in the Doc Sharing tab on the course website: A Relationship Diagram of the database showing in graphical form the 1:M relationships between the tables (336_Lab3_Relationship_Diagram.doc). A Meta Data chart providing information about table names, column names, etc. Be sure to follow this reference exactly when constructing your CREATE TABLE statements (336_Lab3_Data_Dict.xls). A listing of sample data to use when writing the INSERT statements to populate the tables (336_lab3_input_data.doc). The following guidelines are being provided to help assist you in creating your script file: Create the tables in the order shown in the data dictionary. Use the names for the tables and columns as listed in the Meta Data chart – Do not change them as it will affect your grade. Creating CONTRAINTS - Create all constraints as indicated in the data dictionary. Constraint suffixes must be as follows: Primary key constraint – PK Foreign key constraint – FK Check constraint - CC Explicitly name all constraints PRIMARY KEY, FOREIGN KEY, and CHECK constraints to reflect: TableName_ColumnName_ConstraintSuffix (For example, to name a PRIMARY KEY constraint on the SID column in the student table you would use STUDENT_SID_PK.) For this lab you do not have to explicitly name NOT NULL constraints Create all PRIMARY KEY and NOT NULL constraints within the CREATE TABLE statements at the column level (line level), unless the Primary Key is a composite Primary Key (yes, there is one). Composite Primary Key constraints must be created at the table level. Create all FOREIGN KEY and CHECK constraints at the table level using ALTER TABLE statements. All constraints must be added prior to populating the tables with data. Create all of the tables and all of the constraints before populating any of the tables with data. Insert statements must be in the same order as the tables are created (follow the order in the sample data file). ALL character strings must be enclosed in single quotes. This includes alpha strings and alphanumeric (remember that any formatting within a numeric strings makes it alphanumeric). If you are inserting a NULL, do not enclose the word NULL in single quotes, as this will insert the word NULL into the row. To insert a null you simply use the word NULL. Deliverables The deliverable for this lab will include the following documents. Your script file. Create this file in Notepad not Word. Make sure your name is in a comment area at the top of the script file. Use a double dash to create a one line comment:
  • 3. --Jacob Smith --Lab 3 Your lab output file created using a spool session in SQL*Plus. Be sure to use the SET ECHO ON session command when creating the output file so that both the SQL commands and results will show in the output. Be sure your name is on all documents and that all documents have been included in a single Zip file for this week’s assignments. L A B S T E P S STEP 1: The DROP statements The following DROP TABLE statements must appear at the top of your script file. This will allow you to run and re-run your script file as often as you need to. The first time you run your script file you will get an ERROR on the drop statements saying the Table or View does not exist. This is true since it has not been created yet, but the error is more informational than anything. Once the tables are created, you will not get this error again. DROP TABLE ENROLLMENT CASCADE CONSTRAINTS PURGE; DROP TABLE COURSE_SECTION CASCADE CONSTRAINTS PURGE; DROP TABLE COURSE CASCADE CONSTRAINTS PURGE; DROP TABLE TERM CASCADE CONSTRAINTS PURGE; DROP TABLE STUDENT CASCADE CONSTRAINTS PURGE; DROP TABLE FACULTY CASCADE CONSTRAINTS PURGE; DROP TABLE LOCATION CASCADE CONSTRAINTS PURGE; STEP 2: The CREATE TABLE statements Next, define the CREATE TABLE statements for the seven tables that you are to create based upon the ERD and Data Dictionary that you have been given for this lab. Be sure to follow the guidelines given above on how and where to create the different types of constraints for each table. STEP 3: The INSERT statements for the data The third step is to create the insert statements to insert the sample data into the tables created in Step 2. You might find it helpful to take the Word document containing the sample data and save it as a text file. After doing this, you could create the insert statements around the actual data that is in that file. The process for doing this should have been covered in one of the lectures for this unit. If it was not, then ask your instructor to discuss this process with the class. STEP 4: The SELECT statements The next step of the lab will be to create the select statements to verify the data was inserted correctly. You should have seven select statements; one for each table. The command is SELECT * FROM Table_Name; For example, to select all columns from the Student table, the command would be SELECT * FROM Student; Be sure to save all of the above statements in your script file.
  • 4. STEP 5: Testing and verifying your script Now we come to the point of verifying that your script file works by creating all of the tables and inserting all of the data. To verify this you will need to execute your saved script file and create an output file to capture the results being returned to the session by using the spool COMMAND outlined in the tutorial "Using Oracle SQL*Plus." This output file will be one of the files you will be turning in for grading. CLICK HERE TO GET THE SOLUTION !!!!!!!!