SlideShare a Scribd company logo
1 of 37
A Guide to SQL, Ninth Edition
Chapter Six
Updating Data
Objectives
• Create a new table from an existing table
• Change data using the UPDATE command
• Add new data using the INSERT command
• Delete data using the DELETE command
• Use nulls in UPDATE commands
2©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Objectives (continued)
• Change the structure of an existing table
• Use the COMMIT and ROLLBACK commands to
make permanent data updates or to reverse
updates
• Understand transactions and the role of
COMMIT and ROLLBACK in supporting
transactions
• Drop a table
3©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating a New Table from an
Existing Table
• Can create new table using an existing
table
• Use CREATE TABLE command
• Can add query results to table by placing
SELECT command in an INSERT
command
4©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating a New Table from an
Existing Table (continued)
5©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-1: Creating the LEVEL_1_CUSTOMER table
Creating a New Table from an
Existing Table (continued)
6©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-2: INSERT command to add data to the LEVEL_1_CUSTOMER table
Changing Existing Data in a
Table
• Use UPDATE command to change rows for
which a specific condition is true
– Simple or compound condition
• Command format
– UPDATE (name of table to be updated)
– SET (name of the column to be
updated = new value)
• Can include a calculation
7©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing Existing Data in a Table
(continued)
• Simple Condition
8©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-4: UPDATE command to change the name of customer 796
Changing Existing Data in a Table
(continued)
• Compound Condition
9©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-6: Using a compound condition in an update
Adding New Rows to an
Existing Table
• Use the INSERT command to add additional
data to a table
• Use the SELECT command to verify rows were
added correctly
10©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Adding New Rows to an Existing
Table (continued)
11©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-8: Inserting a row
AUTOCOMMIT, COMMIT, and
ROLLBACK
• Autocommit is default transaction mode
– Commits each action query as soon as the
user executes each query
– Clear check mark to turn off Autocommit in
Oracle
• Multi-user database applications require
more control over transactions
12©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
AUTOCOMMIT, COMMIT, and
ROLLBACK (continued)
• Updates to a table are only temporary
– Can cancel during current work session
• COMMIT command
– Saves changes immediately during current session
• ROLLBACK command
– Reverses the changes made since last COMMIT
command or in current work session
13©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
AUTOCOMMIT, COMMIT, and
ROLLBACK (continued)
• ROLLBACK command only reverses changes
made to data
• COMMIT command is permanent
– Running ROLLBACK after COMMIT cannot
reverse the update
14©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Transactions
• A transaction is a logical unit of work
– A sequence of steps that accomplish a single task
– Essential that the entire sequence be completed
successfully
• COMMIT and ROLLBACK commands support
transactions
15©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Transactions (continued)
• Before starting updates for a transaction,
COMMIT any previous updates
• Complete the updates for the transaction
– If it cannot be completed, use ROLLBACK
• If all updates complete, use COMMIT again
16©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing and Deleting Existing
Rows
• Autocommit is turned off
17©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-10 Using an UPDATE command to change the name of customer 665
Changing and Deleting Existing
Rows (continued)
• Use DELETE command to delete data from
database
• Command format
– DELETE (table from which the row(s) is to be
deleted)
– WHERE clause (with a condition to select the
row(s) to delete)
• All rows satisfying the condition will be deleted
• If no condition, then all rows deleted
18©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing and Deleting Existing
Rows (continued)
• Autocommit is turned off
19©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-11: Using DELETE command to delete customer 893
Executing a Rollback
• ROLLBACK command
20©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-14: Data in the LEVEL_1_CUSTOMER table after executing a rollback
Changing a Value in a Column
to Null
• Command for changing value to null is the same
as changing any other value
• Affected column must be able to accept nulls
• Use the value NULL as the replacement value
21©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing a Value in a Column
to Null (continued)
22©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-15: Changing a value in a column to null
Changing a Table’s Structure
• Add new tables
• Delete tables no longer required
• Add new columns to a table
• Change physical characteristics of
existing columns
23©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing a Table’s Structure
(continued)
• ALTER TABLE command allows for changing a
table’s structure
• Use ADD clause to add a new column
– ADD clause is followed by the name of column to
be added, followed by its characteristics
24©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing a Table’s Structure
(continued)
• Assign value to new column
– Simplest approach is to assign NULL as the value
• Or use an UPDATE command
– Change all rows to most common value
– Change individual rows
25©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing a Table’s Structure
(continued)
26©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-17: Adding a column to an existing table
Changing a Table’s Structure
(continued)
27©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-18: Make the same update for all rows
Changing a Table’s Structure
(continued)
28©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-20: Updating customer 334 to customer type S
Changing a Table’s Structure
(continued)
29©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-23: Structure of the LEVEL_1_CUSTOMER table
Changing a Table’s Structure
(continued)
• MODIFY clause of ALTER TABLE command
changes characteristics of existing columns
• Can use to change a column that currently
rejects null values
– Use NULL in place of NOT NULL
• Can increase and decrease size of column
30©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Changing a Table’s Structure
(continued)
31©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-25: Changing the CREDIT_LIMIT column in the LEVEL_1_CUSTOMER table to reject
null values
Making Complex Changes
• Changes to table structure may be beyond the
capabilities of SQL
– Eliminate multiple columns
– Change column order
– Combine data from two tables to one
• Create a new table
32©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Dropping a Table
• Use DROP TABLE command to delete a
table
• Permanently removes table and all its data
from database
33©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Dropping a Table (continued)
34©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Figure 6-27: DROP TABLE command to delete the LEVEL_1_CUSTOMER table
Summary
• Use CREATE TABLE command to make a
new table from an existing table
– INSERT statement containing a SELECT
statement to insert data from existing table
• Use UPDATE command to change data
• Use INSERT command to add new rows
• Use DELETE command to delete existing
rows from a table
35©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Summary (continued)
• Use COMMIT command to make changes
permanent
• Use ROLLBACK command to reverse
updates
• Use SET clause in UPDATE command to
change a value to null
– Column name = NULL
– Column must accept nulls
36©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Summary (continued)
• Use ALTER TABLE command with ADD
clause to add a column to a table
• Use ALTER TABLE command with
MODIFY clause to change column
characteristics
• Use DROP TABLE command to delete a
table and all its data
37©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as
permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.

More Related Content

Similar to Sql9e ppt ch06

Chapt7.ppt
Chapt7.pptChapt7.ppt
Chapt7.pptImXaib
 
Excel module 1 ppt presentation
Excel module 1 ppt presentationExcel module 1 ppt presentation
Excel module 1 ppt presentationdgdotson
 
Excel module 2 ppt presentation
Excel module 2 ppt presentationExcel module 2 ppt presentation
Excel module 2 ppt presentationdgdotson
 
Salesforce Summer'15 release overview
 Salesforce Summer'15 release overview Salesforce Summer'15 release overview
Salesforce Summer'15 release overviewRakesh Gupta
 
9781337102087 ppt ch18
9781337102087 ppt ch189781337102087 ppt ch18
9781337102087 ppt ch18Terry Yoast
 
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...Trivadis
 
SPCA2013 - Successful Migration to SharePoint 2013
SPCA2013 - Successful Migration to SharePoint 2013SPCA2013 - Successful Migration to SharePoint 2013
SPCA2013 - Successful Migration to SharePoint 2013NCCOMMS
 
Chapter 7 - The Repetition Structure
Chapter 7 - The Repetition StructureChapter 7 - The Repetition Structure
Chapter 7 - The Repetition Structuremshellman
 
Access 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentationAccess 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentationdgdotson
 
MaxTECH Building Query Manager for Maximo Plus Enhancement
MaxTECH Building Query Manager for Maximo Plus EnhancementMaxTECH Building Query Manager for Maximo Plus Enhancement
MaxTECH Building Query Manager for Maximo Plus Enhancementsthume
 
9781337102087 ppt ch06
9781337102087 ppt ch069781337102087 ppt ch06
9781337102087 ppt ch06Terry Yoast
 
High performance coding practices code project
High performance coding practices code projectHigh performance coding practices code project
High performance coding practices code projectPruthvi B Patil
 
Project 12 power point
Project 12 power pointProject 12 power point
Project 12 power pointaggie519
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13Terry Yoast
 
Nechyba_2e_Ch_12ABmicroeconomicsslifessss
Nechyba_2e_Ch_12ABmicroeconomicsslifessssNechyba_2e_Ch_12ABmicroeconomicsslifessss
Nechyba_2e_Ch_12ABmicroeconomicsslifessssyildirimfatih1
 
Udf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiUdf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiMuhammed Thanveer M
 
Sql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness GuideSql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness GuidePARIKSHIT SAVJANI
 

Similar to Sql9e ppt ch06 (20)

Chapt7.ppt
Chapt7.pptChapt7.ppt
Chapt7.ppt
 
Excel module 1 ppt presentation
Excel module 1 ppt presentationExcel module 1 ppt presentation
Excel module 1 ppt presentation
 
Excel module 2 ppt presentation
Excel module 2 ppt presentationExcel module 2 ppt presentation
Excel module 2 ppt presentation
 
Salesforce Summer'15 release overview
 Salesforce Summer'15 release overview Salesforce Summer'15 release overview
Salesforce Summer'15 release overview
 
9781337102087 ppt ch18
9781337102087 ppt ch189781337102087 ppt ch18
9781337102087 ppt ch18
 
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
 
SPCA2013 - Successful Migration to SharePoint 2013
SPCA2013 - Successful Migration to SharePoint 2013SPCA2013 - Successful Migration to SharePoint 2013
SPCA2013 - Successful Migration to SharePoint 2013
 
Chapter 7 - The Repetition Structure
Chapter 7 - The Repetition StructureChapter 7 - The Repetition Structure
Chapter 7 - The Repetition Structure
 
Access 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentationAccess 2016 module 4 ppt presentation
Access 2016 module 4 ppt presentation
 
MaxTECH Building Query Manager for Maximo Plus Enhancement
MaxTECH Building Query Manager for Maximo Plus EnhancementMaxTECH Building Query Manager for Maximo Plus Enhancement
MaxTECH Building Query Manager for Maximo Plus Enhancement
 
9781337102087 ppt ch06
9781337102087 ppt ch069781337102087 ppt ch06
9781337102087 ppt ch06
 
High performance coding practices code project
High performance coding practices code projectHigh performance coding practices code project
High performance coding practices code project
 
Project 12 power point
Project 12 power pointProject 12 power point
Project 12 power point
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
Coronel_PPT_Ch11.ppt
Coronel_PPT_Ch11.pptCoronel_PPT_Ch11.ppt
Coronel_PPT_Ch11.ppt
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13
 
Nechyba_2e_Ch_12ABmicroeconomicsslifessss
Nechyba_2e_Ch_12ABmicroeconomicsslifessssNechyba_2e_Ch_12ABmicroeconomicsslifessss
Nechyba_2e_Ch_12ABmicroeconomicsslifessss
 
Udf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiUdf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayi
 
Sql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness GuideSql 2012 Upgrade Readiness Guide
Sql 2012 Upgrade Readiness Guide
 
Lesson 7.1 repitition structure
Lesson 7.1 repitition structureLesson 7.1 repitition structure
Lesson 7.1 repitition structure
 

More from Dr. Ahmed Al Zaidy

Chapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingChapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingDr. Ahmed Al Zaidy
 
Chapter 13 Programming for web forms
Chapter 13 Programming for web formsChapter 13 Programming for web forms
Chapter 13 Programming for web formsDr. Ahmed Al Zaidy
 
Chapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheetsChapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheetsDr. Ahmed Al Zaidy
 
Chapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesChapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesDr. Ahmed Al Zaidy
 
Chapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statementsChapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statementsDr. Ahmed Al Zaidy
 
Chapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptChapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptDr. Ahmed Al Zaidy
 
Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaDr. Ahmed Al Zaidy
 
Chapter 7 Designing a web form
Chapter 7 Designing a web formChapter 7 Designing a web form
Chapter 7 Designing a web formDr. Ahmed Al Zaidy
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsDr. Ahmed Al Zaidy
 
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile webChapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile webDr. Ahmed Al Zaidy
 
Chapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSSChapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSSDr. Ahmed Al Zaidy
 
Chapter 3 Designing a Page Layout
Chapter 3 Designing a Page LayoutChapter 3 Designing a Page Layout
Chapter 3 Designing a Page LayoutDr. Ahmed Al Zaidy
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSDr. Ahmed Al Zaidy
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Dr. Ahmed Al Zaidy
 
testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2Dr. Ahmed Al Zaidy
 
Chapter 15 Risk Mitigation
Chapter 15 Risk MitigationChapter 15 Risk Mitigation
Chapter 15 Risk MitigationDr. Ahmed Al Zaidy
 
Chapter 14 Business Continuity
Chapter 14 Business ContinuityChapter 14 Business Continuity
Chapter 14 Business ContinuityDr. Ahmed Al Zaidy
 
Chapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityChapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityDr. Ahmed Al Zaidy
 

More from Dr. Ahmed Al Zaidy (20)

Chapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingChapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based Programming
 
Chapter 13 Programming for web forms
Chapter 13 Programming for web formsChapter 13 Programming for web forms
Chapter 13 Programming for web forms
 
Chapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheetsChapter 12 Working with Document nodes and style sheets
Chapter 12 Working with Document nodes and style sheets
 
Chapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesChapter 11 Working with Events and Styles
Chapter 11 Working with Events and Styles
 
Chapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statementsChapter 10 Exploring arrays, loops, and conditional statements
Chapter 10 Exploring arrays, loops, and conditional statements
 
Chapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptChapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScript
 
Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimedia
 
Chapter 7 Designing a web form
Chapter 7 Designing a web formChapter 7 Designing a web form
Chapter 7 Designing a web form
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and Columns
 
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile webChapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile web
 
Chapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSSChapter 4 Graphic Design with CSS
Chapter 4 Graphic Design with CSS
 
Chapter 3 Designing a Page Layout
Chapter 3 Designing a Page LayoutChapter 3 Designing a Page Layout
Chapter 3 Designing a Page Layout
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSS
 
Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5Chapter 1 Getting Started with HTML5
Chapter 1 Getting Started with HTML5
 
Integer overflows
Integer overflowsInteger overflows
Integer overflows
 
testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2
 
Fundamental of testing
Fundamental of testingFundamental of testing
Fundamental of testing
 
Chapter 15 Risk Mitigation
Chapter 15 Risk MitigationChapter 15 Risk Mitigation
Chapter 15 Risk Mitigation
 
Chapter 14 Business Continuity
Chapter 14 Business ContinuityChapter 14 Business Continuity
Chapter 14 Business Continuity
 
Chapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityChapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data Security
 

Recently uploaded

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 

Recently uploaded (20)

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 

Sql9e ppt ch06

  • 1. A Guide to SQL, Ninth Edition Chapter Six Updating Data
  • 2. Objectives • Create a new table from an existing table • Change data using the UPDATE command • Add new data using the INSERT command • Delete data using the DELETE command • Use nulls in UPDATE commands 2©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 3. Objectives (continued) • Change the structure of an existing table • Use the COMMIT and ROLLBACK commands to make permanent data updates or to reverse updates • Understand transactions and the role of COMMIT and ROLLBACK in supporting transactions • Drop a table 3©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 4. Creating a New Table from an Existing Table • Can create new table using an existing table • Use CREATE TABLE command • Can add query results to table by placing SELECT command in an INSERT command 4©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 5. Creating a New Table from an Existing Table (continued) 5©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-1: Creating the LEVEL_1_CUSTOMER table
  • 6. Creating a New Table from an Existing Table (continued) 6©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-2: INSERT command to add data to the LEVEL_1_CUSTOMER table
  • 7. Changing Existing Data in a Table • Use UPDATE command to change rows for which a specific condition is true – Simple or compound condition • Command format – UPDATE (name of table to be updated) – SET (name of the column to be updated = new value) • Can include a calculation 7©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 8. Changing Existing Data in a Table (continued) • Simple Condition 8©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-4: UPDATE command to change the name of customer 796
  • 9. Changing Existing Data in a Table (continued) • Compound Condition 9©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-6: Using a compound condition in an update
  • 10. Adding New Rows to an Existing Table • Use the INSERT command to add additional data to a table • Use the SELECT command to verify rows were added correctly 10©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 11. Adding New Rows to an Existing Table (continued) 11©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-8: Inserting a row
  • 12. AUTOCOMMIT, COMMIT, and ROLLBACK • Autocommit is default transaction mode – Commits each action query as soon as the user executes each query – Clear check mark to turn off Autocommit in Oracle • Multi-user database applications require more control over transactions 12©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 13. AUTOCOMMIT, COMMIT, and ROLLBACK (continued) • Updates to a table are only temporary – Can cancel during current work session • COMMIT command – Saves changes immediately during current session • ROLLBACK command – Reverses the changes made since last COMMIT command or in current work session 13©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 14. AUTOCOMMIT, COMMIT, and ROLLBACK (continued) • ROLLBACK command only reverses changes made to data • COMMIT command is permanent – Running ROLLBACK after COMMIT cannot reverse the update 14©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 15. Transactions • A transaction is a logical unit of work – A sequence of steps that accomplish a single task – Essential that the entire sequence be completed successfully • COMMIT and ROLLBACK commands support transactions 15©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 16. Transactions (continued) • Before starting updates for a transaction, COMMIT any previous updates • Complete the updates for the transaction – If it cannot be completed, use ROLLBACK • If all updates complete, use COMMIT again 16©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 17. Changing and Deleting Existing Rows • Autocommit is turned off 17©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-10 Using an UPDATE command to change the name of customer 665
  • 18. Changing and Deleting Existing Rows (continued) • Use DELETE command to delete data from database • Command format – DELETE (table from which the row(s) is to be deleted) – WHERE clause (with a condition to select the row(s) to delete) • All rows satisfying the condition will be deleted • If no condition, then all rows deleted 18©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 19. Changing and Deleting Existing Rows (continued) • Autocommit is turned off 19©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-11: Using DELETE command to delete customer 893
  • 20. Executing a Rollback • ROLLBACK command 20©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-14: Data in the LEVEL_1_CUSTOMER table after executing a rollback
  • 21. Changing a Value in a Column to Null • Command for changing value to null is the same as changing any other value • Affected column must be able to accept nulls • Use the value NULL as the replacement value 21©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 22. Changing a Value in a Column to Null (continued) 22©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-15: Changing a value in a column to null
  • 23. Changing a Table’s Structure • Add new tables • Delete tables no longer required • Add new columns to a table • Change physical characteristics of existing columns 23©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 24. Changing a Table’s Structure (continued) • ALTER TABLE command allows for changing a table’s structure • Use ADD clause to add a new column – ADD clause is followed by the name of column to be added, followed by its characteristics 24©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 25. Changing a Table’s Structure (continued) • Assign value to new column – Simplest approach is to assign NULL as the value • Or use an UPDATE command – Change all rows to most common value – Change individual rows 25©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 26. Changing a Table’s Structure (continued) 26©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-17: Adding a column to an existing table
  • 27. Changing a Table’s Structure (continued) 27©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-18: Make the same update for all rows
  • 28. Changing a Table’s Structure (continued) 28©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-20: Updating customer 334 to customer type S
  • 29. Changing a Table’s Structure (continued) 29©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-23: Structure of the LEVEL_1_CUSTOMER table
  • 30. Changing a Table’s Structure (continued) • MODIFY clause of ALTER TABLE command changes characteristics of existing columns • Can use to change a column that currently rejects null values – Use NULL in place of NOT NULL • Can increase and decrease size of column 30©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 31. Changing a Table’s Structure (continued) 31©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-25: Changing the CREDIT_LIMIT column in the LEVEL_1_CUSTOMER table to reject null values
  • 32. Making Complex Changes • Changes to table structure may be beyond the capabilities of SQL – Eliminate multiple columns – Change column order – Combine data from two tables to one • Create a new table 32©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 33. Dropping a Table • Use DROP TABLE command to delete a table • Permanently removes table and all its data from database 33©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 34. Dropping a Table (continued) 34©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. Figure 6-27: DROP TABLE command to delete the LEVEL_1_CUSTOMER table
  • 35. Summary • Use CREATE TABLE command to make a new table from an existing table – INSERT statement containing a SELECT statement to insert data from existing table • Use UPDATE command to change data • Use INSERT command to add new rows • Use DELETE command to delete existing rows from a table 35©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 36. Summary (continued) • Use COMMIT command to make changes permanent • Use ROLLBACK command to reverse updates • Use SET clause in UPDATE command to change a value to null – Column name = NULL – Column must accept nulls 36©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
  • 37. Summary (continued) • Use ALTER TABLE command with ADD clause to add a column to a table • Use ALTER TABLE command with MODIFY clause to change column characteristics • Use DROP TABLE command to delete a table and all its data 37©2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.