Manipulating Data
Describe each DML statement.
- Insert
- An INSERT statement creates a row or rows and stores them in the named table.
- Update
- The UPDATE statement is used to modify the data in a table.
- Delete
- The DELETE statement is used to delete rows in a table.
- Merge
- The MERGE statement, which combines the INSERT, DELETE, and UPDATE operations, allows you to move data from a transaction table to a master table with a single pass over the transaction table. Rows in the transaction table that match entries in the master table are used to update or delete rows from the master table, while those rows where there is no match can be inserted. Since the qualifying rows from the transaction table are available in the SET clause of the UPDATE operation, the MERGE statement provides a simple. Primarily of value when moving large amounts of data in data warehouse situations.
- Select
- The SELECT statement is used to query the database and retrieve selected data that match the criteria that you specify.
Insert rows into a table
insert into state_city
(state_abbrev, city_name)
values
('CA', 'San Francisco');
COMMIT;
Update rows in a table
UPDATE <table_name>
SET <column_name> = <value>
WHERE <column_name> = <value>
SELECT DISTINCT object_name
FROM test;
UPDATE test
SET object_name = 'LOAD'
WHERE object_name = 'DUAL';
Delete rows in a table
delete person where last_name = 'Jeremy';
Merge rows in a table
CREATE TABLE employee (
employee_id number(5),
first_name varchar2(20),
last_name varchar2(20),
dept_no number(2),
salary number(10))
tablespace data_sml;
insert into employee values (1, 'Paris', 'Hilton', 10, 100000);
insert into employee values (2, 'Nicky', 'Hilton', 20, 100000);
insert into employee values (3, 'Suzanna', 'Spears', 20, 50000);
insert into employee values (4, 'Maria', 'Sharpanova', 20, 40000);
commit;
create table bonuses (
employee_id number, bonus number default 100)
tablespace data_sml;
insert into bonuses (employee_id) values (1);
insert into bonuses (employee_id) values (2);
insert into bonuses (employee_id) values (4);
insert into bonuses (employee_id) values (6);
insert into bonuses (employee_id) values (7);
commit;
merge into bonuses B
using (
select employee_id, salary
from employee
where dept_no = 20) E
on (B.employee_id = E.employee_id)
when matched then
update set B.bonus = E.salary * 0.1
when not matched then
insert (B.employee_id, B.bonus)
values (E.employee_id, E.salary * 0.05);
Control Transactions
/*commit and rollback savepoint; when a savepoint is defined within a statement, it can be rolledback up to that particular point*/
insert into nomina(sueldo) values(1000000);
savepoint excelente;
insert into nomina(sueldo) values(100000);
savepoint bueno;
insert into nomina(sueldo) values(10000);
savepoint salario_mexicano;
commit;
/*eventhough the commit was already issued, we can still rollaback up to a savepoint location with:
ROLLBACK to bueno
That would rollback the insert with a value of 10000*/
home |
archives |
about me |
faq |
my resume |
you tube |
pics |
site map |
More...
ASP.Net |
Get State By Zip Code, VB.Net |
Editing an XML Document, VB.Net |
Accessing an XML Document, VB.Net |
Salary Bi-Directional Scrollable DataGrid C# |
State Bi-Directional Scrollable DataGrid C# |
IEWebControls - Microsoft's Way |
IEWebControls - My Way |
IEWebControls - MultiPage |
Multipage code |
IE WebControls - TabStrip |
TabStrip |
IEWebControls - Toolbar |
Toolbar code |
IEWebControls - Treeview |
Treeview code |
IEWebControls - Treeview Bound |
Treeview Bound code |
IEWebControls - Tree |
Tree code |
Fibonacci Numbers Demo |
Magic Numbers Demo |
Toolbar XML |
Toolbar XSL |
JavaScript |
Dynamic Form Size Counter |
Interest Calculator |
Get the Browser Type |
Cascading Menus |
More Cascading Menus |
Change Fonts through JavaScript and CSS |
JavaScript Dynamic Clock |
Copy Radio Button value to a Textbox |
JavaScript Dropdown State Textbox Search |
JavaScript Last Updated the Document |
Dynamic JavaScript Date Dropdown box |
JavaScript Code Decryptor Encryptor |
JavaScript Code Decryptor Encryptor |
Dynamic Form Field Character Size Checker set at 2000 varchar |
JavaScript MouseOver Hidden Messages |
JavaScript Dropdown list Search: value sent to QueryString |
JavaScript DDL Values Listbox to Listbox: IE, Moz |
JavaScript Country Filter Dropdown list Search form with Regular Expressions |
Scrolling JavaScript Marquee |
Another Calculator |
JavaScript Form Validation with Regular Expressions: complete |
JavaScript Link Selector from a Dropdown Menu |
Nice Dynamic Javascript Panels for searching and so forth |
JavaScript Dynamic Table Sorter |
JavaScript / HTML / HTML Component Text Highlighter for Internet Explorer and Gecko aka Mozill Firefox, AOL, and Netscape |
sql |
Normalization |
First Normal Form |
Second Normal Form |
Third Normal Form |
Fourth and Fifth Normal Form |
Inner Join |
Outer Join |
SQL Server 2000 versus Access 2002 |
Stored Procedure |
oracle |
Basic SQL Select |
Execute SELECT statement |
SQL statements and iSQL*Plus |
Restricting and Sorting Data |
Limit the rows |
Sort the rows retrieved by a query |
Single-Row Functions |
Various SQL Functions |
Character, number, and Date functions |
Use conversion functions |
Displaying Data from Multiple Tables |
Write SELECT statements to access data from more than one table using equality and nonequality joins |
View data Outer Joins |
Join a table to itself |
Aggregating Data |
Identify Group Functions |
Use Group Functions |
Group data GROUP BY |
HAVING clause |
Subqueries |
Problems that subqueries can solve |
Define subqueries |
List the types of subqueries |
Write single-row and multiple-row subqueries |
Output with iSQL*Plus |
Substitution Variable |
Readable output |
Create and execute script files |
Manipulating Data |
Describe each DML statement |
Insert rows into a table |
Update rows in a table |
Delete rows from a table |
Merge rows in a table |
Control transactions |
Creating and Managing Tables |
Main database objects |
Create tables |
Datatypes specifying column definition |
Alter table definitions |
Drop, rename and truncate tables |
Including Constraints |
Describe constraints |
Create and maintain constraints |
Creating Views |
Describe a view |
Create, alter the definition, and drop a view |
Retrieve data through a view |
Insert, update and delete data through a view |
Creating Other Database Objects |
Create, maintain and use sequences |
Create and maintain indexes |
Create private and public synonyms |
java |
City Planner |
CPU Scheduler |
Acme House System |
Number Searcher |
Password |
Producer Consumer |
Producer Consumer |
Producer Consumer No Buffer |
Producer Consumer Buffer 100 |
XML |
001.xml |
access_vs_sql.xml |
access_vs_sql.xsl |
admin |
admin |
arearate.htm |
arearate.xml |
arearate.xsd |
arearate.xsl |
arearate.xsx |
aspnet.xml |
aspnet.xsl |
aspnetbooks |
behave.htc |
behavior.htm |
bloglinks.xsl |
BottomLinks |
BUILDING.xml |
BUILDING.xsd |
Categories.xml |
cd_catalog.xml |
cdcatalog.xml |
cdcatalog.xsl |
cdcatalog_ |
cdcatalog |
cdcatalog_if |
cdcatalog_if |
cdcatalog |
cdcatalog |
cdcatalog |
Celebs.xml |
Celebs.xsl |
cities.txt |
cities_world.txt |
comment.htm |
comment.xml |
comment.xsd |
comment.xsl |
comment.xsx |
Contact.xml |
contact.xsl |
Contents.xml |
Contents.xslt |
COURSE.xml |
COURSE.xsd |
cursor_types.htm |
data_island.htm |
dispBooks.xsl |
dotnet.xml |
EditRecord.xml |
entire.xml |
entire.xsl |
ExtraLinks.xml |
ExtraLinks.xsl |
FACULTY.xml |
FACULTY.xsd |
FileName.xml |
FileName.xsd |
filesystem |
gakenheimer |
gakenheimer |
guestbook.xml |
home.xml |
home.xsd |
HTML Entities |
IS_QUALIFIED |
IS_QUALIFIED |
IS_REGISTERED |
IS_REGISTERED |
Java |
javascript |
javascript |
js.xml |
level1.xml |
LOGIN.xml |
LOGIN.xsd |
main.xsl |
MainLinks |
MainLinks |
MAJOR.xml |
MAJOR.xsd |
na_cities.xml |
Oracle |
OtherStuff |
OtherStuff |
people.xml |
PERSON.xsd |
RECORD.xsd |
rss.xml |
rss.xsl |
samples.xml |
SCHEDULE.xml |
SCHEDULE.xsd |
site.xml |
site.xsd |
sql.xml |
sql.xsl |
SS_table |
SS_table |
State.xml |
State.xsd |
states.htm |
states.xml |
states_move.htm |
states_move2.htm |
STUDENT.xsd |
TITLE.xml |
TITLE.xsd |
TopLinks.xsl |
updatedcontact |
world_cities.xml |
xmllinks.htm |
xmllinks.xml |
Algorithms |
Backjumping Algorithm |
Barnes-hut Algorithm |
Las Vegas and Monte Carlo Algorithm |
DBMS |
developer a database management system |
Downloads Directory |
balderdash |
content links |
CPUScheduler |
cheers |
CityPlanner |
Concat Strings |
Old Formal Resume |
joe resume .doc |
joe resume .txt |
Joseph Gakenheimer Resume .doc |
Knapsack |
My Shopping Cart Servlet |
NumberSearcher |
PasswordChecker |
SchoolSystem |
Stored Procedures |
Flash |
animals |
clock 0 |
clock 1 |
clock 2 |
clock 3 |
clock 4 |
clock 5 |
case 5 |
form |
hyperlink |
readymed |
snow |
HTML Templates |
calendar |
freud |
readymed |
excel |
old site template |
venus template |
Java |
Coming Soon |
JSP Research |
JSP Versus ASP |
J2EE Versus ASP.Net |
J2EE Versus ASP.Net Components |
MIS Windows 200 |
Action Plan - Active Directory Services |
Active Directory Services |
Challenges IS |
Monitoring Tools and Improvement |
Network Printing Environment |
An Overview of NTFS |
Proposal for Outsourcing Systems and Software Maintenance |
Hardware User Needs |
Windows 2000 Keypoints |
Operating Systems |
History of Operating Systems |
Operating System Questions |
Operating System Terms |
Clustering |
Open Source Acceptance |
Networking |
The Secure Socket Layer Review |
Network Design Proposal |
Exam 1 Review |
Exam 2 Review |
Software Engineering |
DinnerWare Software Design |
DinnerWare Software .doc |
DinnerWare Software .ppt |
Home |
Home |
About Me |
Archives |
FAQ |
My Resume |
My Portfolio |
Pics |
Site Map |
Updated: July 30, 2005; Joe Gakenheimer
© joegakenheimer.com