SlideShare une entreprise Scribd logo
1  sur  20
Using SQL Queries to Insert,
Update, Delete, and View Data
© Abdou Illia MIS 4200 - Spring 2015
Wednesday 1/28/2015
Chapter 3A
2
Lesson 3A Objectives
You should know how to:
Run a script to create database tables
automatically
Insert data into database tables
Create database transactions and commit data to
the database
Create search conditions in SQL queries
Update and delete database records and truncate
tables
Create and use sequences to generate surrogate
key values automatically
3
Using Scripts to Create Database Tables
SQL Script
– Text file that contains one or more SQL statements
– Contains only SQL statements
– File extension must be .sql
Run a script
– At SQL prompt, type one of the following:
 start pathfilemane
 @ pathfilemane
– Example: start oralab00.sql
– Example: @ F:MIS4200script1.sql
CREATE TABLE location
(loc_id NUMBER(5),
bldg_code NUMBER(3)
room VARCHAR2(20);
DESCRIBE location
ALTER TABLE location
ADD (capacity NUMBER(5);
Script1.sql
4
Using the INSERT Command
Basic syntax for inserting data into every column:
INSERT INTO tablename
VALUES (column1_value, column2_value, … );
– Must list values in same order as in CREATE TABLE
– If a data value is unknown, must type NULL
– If character data, must use single quotation marks
– Value in quotations is case sensitive
Basic syntax for inserting into selected columns
INSERT INTO tablename (columnname1, columnname2, …)
VALUES (column1_value, column2_value, … );
Note: To specify 454 St. John’s Place, must type '454 St. John ''s Place'
Question: If you couldn’t remember the columns’ order for the table you want to insert data in, what command can you use in SQL Plus to verify?
INSERT INTO student
VALUES (‘JO100’, ‘Jones’, ‘Tammy’, ‘R’, ‘1817 Eagleridge Circle’, ‘Tallahassee’, ‘FL’, ‘32811’, ‘7155559876’, ‘SR’,
TO_DATE(‘07/14/1984’ ,‘MM/DD/YYYY’), ‘8891’, 1, TO_YMINTERVAL(‘3-2’));
Example
5
Using the INSERT Command (cont.)
 Ensure all foreign keys that new row references have
already been added to database.
 Cannot insert a foreign key value unless the corresponding
primary key is in the primary table.
6
Format Models
Also called format mask
Used to specify different output format from default
For NUMBER data types, 9 represents digit
For DATE/TIMESTAMP data types
– Choose formats for year day, date, etc.
With the $9999.99 mask, 1250.75 appears as $1250.75
With the $9999.99 mask, how will appear 1500? 2340.1?
7
Inserting Date and Interval Values
Inserting values into DATE columns
– Use TO_DATE function to convert string to DATE
– Syntax:
TO_DATE('date_string', 'date_format_model')
– Example:
TO_DATE ('08/24/2010', 'MM/DD/YYYY’)
Inserting values into INTERVAL columns
– Syntax
•TO_YMINTERVAL('years-months')
•TO_DSINTERVAL('days HH:MI:SS.99')
INSERT INTO student
VALUES (‘JO100’, ‘Jones’, ‘Tammy’, ‘R’, ‘1817 Eagleridge Circle’, ‘Tallahassee’, ‘FL’, ‘32811’,
‘7155559876’, ‘SR’, TO_DATE(‘07/14/1984’ ,‘MM/DD/YYYY’), ‘8891’, 1, TO_YMINTERVAL(‘3-2’));
Example
8
Inserting LOB Column Locators
Oracle stores LOB data in separate (alternate)
physical location from other types of data
LOB locator needs to be created to
– Hold information that identifies LOB data type, and
– Point to alternate memory location
Syntax for creating blob locator
EMPTY_BLOB()
INSERT INTO faculty (f_id, f_last, f_first, f_image)
VALUES (2, ‘Zhulin’, ‘Mark’, EMPTY_BLOB());
9
Creating Transactions and Committing
New Data
Transaction
– Represents logical unit of work (or action queries)
– All of action queries must succeed or no transaction can
succeed
When a problem occurs and prevents some queries in a
transaction to succeed, Oracle allows you rollback
Rollback
– Discard changes in transaction using ROLLBACK
Commit
– Save changes in transaction using COMMIT
10
Creating Transactions & Committing Data (cont)
Purpose of transaction processing
– Enable users to see consistent view of database
– Preventing users from viewing or updating data that are
part of a pending (uncommitted) transaction
New transaction begins when SQL*Plus started and
command executed
Transaction ends when current transaction committed
ROLLBACK command restores database to point
before last commit
11
Rollback and Savepoints
Savepoints are used to rollback transactions to a
certain point.
12
Creating Search Conditions in SQL
Queries
Search condition
– Expression that seeks to match specific table rows
Syntax
WHERE columnname comparison_operator search_expression
Example:
DELETE FROM student WHERE s_id = ‘JO100’
13
Defining Search Expressions
NUMBER example: WHERE f_id = 1
Character data example: WHERE s_class = 'SR'
DATE example
WHERE s_dob = TO_DATE('01/01/1980', ‘MM/DD/YYYY')
Creating Complex Search Conditions
Complex search condition combines multiple search
conditions using logical operators
AND logical operator: True if both conditions true
OR logical operator: True if one condition true
NOT logical operator: Matches opposite of search
condition WHERE bldg_code = ‘CR’ AND capacity > 50
Example
14
Updating Table Rows
UPDATE action query syntax
UPDATE tablename
SET column1 = new_value1, column2 = new_value2, …
WHERE search condition;
Question: In a previous class session, we learned about the ALTER TABLE command. What is the
difference between the ALTER TABLE and the UPDATE commands?
15
Deleting Table Rows
The DELETE action query removes specific rows
Syntax:
DELETE FROM tablename
WHERE search condition;
The TRUNCATE action query removes all rows
– TRUNCATE TABLE tablename;
Cannot truncate table with foreign key constraints
– Must disable constraints, first, using
ALTER TABLE tablename
DISABLE CONSTRAINT constraint_name;
16
Deleting Table Rows (continued)
Child row: a row containing a value as foreign key
– Cannot delete row if it has child row. In other words,
you cannot delete a “parent” row …
• Unless you, first, delete row in which foreign key value
exists
– Cannot delete LOCATION row for loc_id = 9 unless
you delete FACULTY row for f_id = 1
FACULTY
F_ID F_LAST F_FIRST F_MI LOC_ID
1 Marx Teresa I 9
LOCATION
LOC_ID BLDG_CODE ROOM CAPACITY
9 BUS 424 1
Child row
“Parent” row
17
Creating New Sequences
A sequence is a series of number like 1, 2, 3, …
A sequence can be created as a database object
CREATE SEQUENCE is used to create a sequence
– CREATE SEQUENCE is a DDL command
– No need to issue COMMIT command because (it’s a
DDL command)
Example:
CREATE SEQUENCE loc_id_sequence
START WITH 20;
 CACHE stores 20 sequence numbers by default
 CYCLE: when a minimum and a maximum are set,
CYCLE allows the sequence to restart from minimum
when the maximum is reached.
18
Viewing Sequence Information
The USER_SEQUENCES data dictionary view
contains
– sequence_name
– sequence_minvalue
– sequence_maxvalue, etc.
Example (for viewing sequences’ info):
SELECT sequence_name, sequence_minvalue
FROM user_sequences;
19
Using Sequences
A pseudocolumn
– acts like column in database table
– is actually a command that returns specific value
CURRVAL
– sequence_name.CURRVAL returns most
recent sequence value retrieved
NEXTVAL
– sequence_name.NEXTVAL returns next
available sequence value
INSERT INTO location
VALUES (loc__id_sequence.NEXTVAL, ‘CC, ‘105’, 150);
Example
20
Using Sequences (continued)
DUAL
– Simple table in the SYSTEM user schema
– More efficient to retrieve pseudocolumns from DUAL
SELECT sequence_name.NEXTVAL
FROM DUAL;
DBMS uses user sessions
– To ensure that all sequence users receive unique
sequence numbers

Contenu connexe

Similaire à mis4200notes4_2.ppt

CC105-WEEK10-11-INTRODUCTION-TO-SQL.pdf
CC105-WEEK10-11-INTRODUCTION-TO-SQL.pdfCC105-WEEK10-11-INTRODUCTION-TO-SQL.pdf
CC105-WEEK10-11-INTRODUCTION-TO-SQL.pdf
ozaixyzo
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
Reka
 
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxCharles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
christinemaritza
 

Similaire à mis4200notes4_2.ppt (20)

Oracle notes
Oracle notesOracle notes
Oracle notes
 
CC105-WEEK10-11-INTRODUCTION-TO-SQL.pdf
CC105-WEEK10-11-INTRODUCTION-TO-SQL.pdfCC105-WEEK10-11-INTRODUCTION-TO-SQL.pdf
CC105-WEEK10-11-INTRODUCTION-TO-SQL.pdf
 
chap 7.ppt(sql).ppt
chap 7.ppt(sql).pptchap 7.ppt(sql).ppt
chap 7.ppt(sql).ppt
 
Chap 7
Chap 7Chap 7
Chap 7
 
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdfDBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf
 
Lab
LabLab
Lab
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
Adbms 21 sql 99 schema definition constraints and queries
Adbms 21 sql 99 schema definition constraints and queriesAdbms 21 sql 99 schema definition constraints and queries
Adbms 21 sql 99 schema definition constraints and queries
 
lovely
lovelylovely
lovely
 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
 
Sql commands
Sql commandsSql commands
Sql commands
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxCharles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
 

Dernier

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Dernier (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 

mis4200notes4_2.ppt

  • 1. Using SQL Queries to Insert, Update, Delete, and View Data © Abdou Illia MIS 4200 - Spring 2015 Wednesday 1/28/2015 Chapter 3A
  • 2. 2 Lesson 3A Objectives You should know how to: Run a script to create database tables automatically Insert data into database tables Create database transactions and commit data to the database Create search conditions in SQL queries Update and delete database records and truncate tables Create and use sequences to generate surrogate key values automatically
  • 3. 3 Using Scripts to Create Database Tables SQL Script – Text file that contains one or more SQL statements – Contains only SQL statements – File extension must be .sql Run a script – At SQL prompt, type one of the following:  start pathfilemane  @ pathfilemane – Example: start oralab00.sql – Example: @ F:MIS4200script1.sql CREATE TABLE location (loc_id NUMBER(5), bldg_code NUMBER(3) room VARCHAR2(20); DESCRIBE location ALTER TABLE location ADD (capacity NUMBER(5); Script1.sql
  • 4. 4 Using the INSERT Command Basic syntax for inserting data into every column: INSERT INTO tablename VALUES (column1_value, column2_value, … ); – Must list values in same order as in CREATE TABLE – If a data value is unknown, must type NULL – If character data, must use single quotation marks – Value in quotations is case sensitive Basic syntax for inserting into selected columns INSERT INTO tablename (columnname1, columnname2, …) VALUES (column1_value, column2_value, … ); Note: To specify 454 St. John’s Place, must type '454 St. John ''s Place' Question: If you couldn’t remember the columns’ order for the table you want to insert data in, what command can you use in SQL Plus to verify? INSERT INTO student VALUES (‘JO100’, ‘Jones’, ‘Tammy’, ‘R’, ‘1817 Eagleridge Circle’, ‘Tallahassee’, ‘FL’, ‘32811’, ‘7155559876’, ‘SR’, TO_DATE(‘07/14/1984’ ,‘MM/DD/YYYY’), ‘8891’, 1, TO_YMINTERVAL(‘3-2’)); Example
  • 5. 5 Using the INSERT Command (cont.)  Ensure all foreign keys that new row references have already been added to database.  Cannot insert a foreign key value unless the corresponding primary key is in the primary table.
  • 6. 6 Format Models Also called format mask Used to specify different output format from default For NUMBER data types, 9 represents digit For DATE/TIMESTAMP data types – Choose formats for year day, date, etc. With the $9999.99 mask, 1250.75 appears as $1250.75 With the $9999.99 mask, how will appear 1500? 2340.1?
  • 7. 7 Inserting Date and Interval Values Inserting values into DATE columns – Use TO_DATE function to convert string to DATE – Syntax: TO_DATE('date_string', 'date_format_model') – Example: TO_DATE ('08/24/2010', 'MM/DD/YYYY’) Inserting values into INTERVAL columns – Syntax •TO_YMINTERVAL('years-months') •TO_DSINTERVAL('days HH:MI:SS.99') INSERT INTO student VALUES (‘JO100’, ‘Jones’, ‘Tammy’, ‘R’, ‘1817 Eagleridge Circle’, ‘Tallahassee’, ‘FL’, ‘32811’, ‘7155559876’, ‘SR’, TO_DATE(‘07/14/1984’ ,‘MM/DD/YYYY’), ‘8891’, 1, TO_YMINTERVAL(‘3-2’)); Example
  • 8. 8 Inserting LOB Column Locators Oracle stores LOB data in separate (alternate) physical location from other types of data LOB locator needs to be created to – Hold information that identifies LOB data type, and – Point to alternate memory location Syntax for creating blob locator EMPTY_BLOB() INSERT INTO faculty (f_id, f_last, f_first, f_image) VALUES (2, ‘Zhulin’, ‘Mark’, EMPTY_BLOB());
  • 9. 9 Creating Transactions and Committing New Data Transaction – Represents logical unit of work (or action queries) – All of action queries must succeed or no transaction can succeed When a problem occurs and prevents some queries in a transaction to succeed, Oracle allows you rollback Rollback – Discard changes in transaction using ROLLBACK Commit – Save changes in transaction using COMMIT
  • 10. 10 Creating Transactions & Committing Data (cont) Purpose of transaction processing – Enable users to see consistent view of database – Preventing users from viewing or updating data that are part of a pending (uncommitted) transaction New transaction begins when SQL*Plus started and command executed Transaction ends when current transaction committed ROLLBACK command restores database to point before last commit
  • 11. 11 Rollback and Savepoints Savepoints are used to rollback transactions to a certain point.
  • 12. 12 Creating Search Conditions in SQL Queries Search condition – Expression that seeks to match specific table rows Syntax WHERE columnname comparison_operator search_expression Example: DELETE FROM student WHERE s_id = ‘JO100’
  • 13. 13 Defining Search Expressions NUMBER example: WHERE f_id = 1 Character data example: WHERE s_class = 'SR' DATE example WHERE s_dob = TO_DATE('01/01/1980', ‘MM/DD/YYYY') Creating Complex Search Conditions Complex search condition combines multiple search conditions using logical operators AND logical operator: True if both conditions true OR logical operator: True if one condition true NOT logical operator: Matches opposite of search condition WHERE bldg_code = ‘CR’ AND capacity > 50 Example
  • 14. 14 Updating Table Rows UPDATE action query syntax UPDATE tablename SET column1 = new_value1, column2 = new_value2, … WHERE search condition; Question: In a previous class session, we learned about the ALTER TABLE command. What is the difference between the ALTER TABLE and the UPDATE commands?
  • 15. 15 Deleting Table Rows The DELETE action query removes specific rows Syntax: DELETE FROM tablename WHERE search condition; The TRUNCATE action query removes all rows – TRUNCATE TABLE tablename; Cannot truncate table with foreign key constraints – Must disable constraints, first, using ALTER TABLE tablename DISABLE CONSTRAINT constraint_name;
  • 16. 16 Deleting Table Rows (continued) Child row: a row containing a value as foreign key – Cannot delete row if it has child row. In other words, you cannot delete a “parent” row … • Unless you, first, delete row in which foreign key value exists – Cannot delete LOCATION row for loc_id = 9 unless you delete FACULTY row for f_id = 1 FACULTY F_ID F_LAST F_FIRST F_MI LOC_ID 1 Marx Teresa I 9 LOCATION LOC_ID BLDG_CODE ROOM CAPACITY 9 BUS 424 1 Child row “Parent” row
  • 17. 17 Creating New Sequences A sequence is a series of number like 1, 2, 3, … A sequence can be created as a database object CREATE SEQUENCE is used to create a sequence – CREATE SEQUENCE is a DDL command – No need to issue COMMIT command because (it’s a DDL command) Example: CREATE SEQUENCE loc_id_sequence START WITH 20;  CACHE stores 20 sequence numbers by default  CYCLE: when a minimum and a maximum are set, CYCLE allows the sequence to restart from minimum when the maximum is reached.
  • 18. 18 Viewing Sequence Information The USER_SEQUENCES data dictionary view contains – sequence_name – sequence_minvalue – sequence_maxvalue, etc. Example (for viewing sequences’ info): SELECT sequence_name, sequence_minvalue FROM user_sequences;
  • 19. 19 Using Sequences A pseudocolumn – acts like column in database table – is actually a command that returns specific value CURRVAL – sequence_name.CURRVAL returns most recent sequence value retrieved NEXTVAL – sequence_name.NEXTVAL returns next available sequence value INSERT INTO location VALUES (loc__id_sequence.NEXTVAL, ‘CC, ‘105’, 150); Example
  • 20. 20 Using Sequences (continued) DUAL – Simple table in the SYSTEM user schema – More efficient to retrieve pseudocolumns from DUAL SELECT sequence_name.NEXTVAL FROM DUAL; DBMS uses user sessions – To ensure that all sequence users receive unique sequence numbers

Notes de l'éditeur

  1. Question: If you couldn’t remember the columns’ order the table you want to insert data in, what command can you use in SQL Plus to verify?