<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2970226258851312603</id><updated>2024-02-08T05:18:59.803+05:30</updated><category term="Center Alignment In C"/><category term="Center Alignment Program"/><category term="Code for Alignment"/><category term="DDL"/><category term="DDL &amp; DML Concept"/><category term="DML"/><category term="DML with SQL Server"/><category term="Interchanging Program in C"/><category term="Program to  Center Alignment in C"/><category term="Swapping Program in C"/><title type='text'>SG Programmers</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sgprogrammers.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sgprogrammers.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/18053304515897945192</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2970226258851312603.post-3822797001137818710</id><published>2012-10-06T08:41:00.001+05:30</published><updated>2013-08-24T08:18:39.101+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DDL"/><category scheme="http://www.blogger.com/atom/ns#" term="DDL &amp; DML Concept"/><category scheme="http://www.blogger.com/atom/ns#" term="DML"/><category scheme="http://www.blogger.com/atom/ns#" term="DML with SQL Server"/><title type='text'>DDL and DML Concepts</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 18.0pt; line-height: 115%;&quot;&gt;Data Definition Language(DDL)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
DDL statements are used to build
and modify the structure of your tables and other objects in the database. When
you execute a DDL statement, it takes effect immediately. The most basic items
of DDL are the&amp;nbsp;CREATE,&amp;nbsp;ALTER, RENAME,&amp;nbsp;DROP&amp;nbsp;and&amp;nbsp;TRUNCATE&amp;nbsp;statements:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&amp;nbsp; &amp;nbsp;1. &lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&lt;u&gt;&amp;nbsp;&lt;/u&gt;&lt;/span&gt;&lt;u&gt;The
create table statement does exactly that:&lt;/u&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;b&gt;CREATE TABLE&lt;/b&gt;
&amp;lt;table name&amp;gt; ( &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;attribute
name 1&amp;gt; &amp;lt;data type 1&amp;gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;attribute
name n&amp;gt; &amp;lt;data type n&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify; text-indent: .5in;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
The&amp;nbsp;data types&amp;nbsp;that you
will use most frequently are character strings, which might be called VARCHAR
or CHAR for variable or fixed length strings; numeric types such as NUMBER or
INTEGER, which will usually specify a precision; and DATE or related types.
Data type syntax is variable from system to system; the only way to be sure is
to consult the documentation for your own software.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2. &amp;nbsp;The
alter table statement may be used as you have seen to specify primary and
foreign key constraints, as well as to make other modifications to the table structure.
Key constraints may also be specified in the CREATE TABLE statement.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;ALTER TABLE&lt;/b&gt; &amp;lt;table name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;ADD
CONSTRAINT&lt;/b&gt; &amp;lt;constraint name&amp;gt; &lt;b&gt;PRIMARY KEY&lt;/b&gt; (&amp;lt;attribute
list&amp;gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
You get to specify the constraint
name. Get used to following a convention of tablename_pk (for example,
Customers_pk), so you can remember what you did later. The attribute list
contains the one or more attributes that form this PK; if more than one, the
names are separated by commas.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;!--[endif]--&gt;The
foreign key constraint is a bit more complicated, since we have to specify both
the FK attributes in this (child) table, and the PK attributes that they link
to in the parent table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .25in;&quot;&gt;
&lt;b&gt;&amp;nbsp;ALTER
TABLE&lt;/b&gt; &amp;lt;table name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;ADD CONSTRAINT&lt;/b&gt;
&amp;lt;constraint name&amp;gt; &lt;b&gt;FOREIGN KEY&lt;/b&gt; (&amp;lt;attribute list&amp;gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;REFERENCES &lt;/b&gt;&amp;lt;parent table
name&amp;gt; (&amp;lt;attribute list&amp;gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Name the constraint in the form
childtable_parenttable_fk (for example, Orders_Customers_fk). If there is more
than one attribute in the FK, all of them must be included (with commas
between) in both the FK attribute list and the &lt;b&gt;REFERENCES&lt;/b&gt; (parent table)
attribute list.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
You need a separate foreign key
definition for each relationship in which this table is the child.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;If
you totally mess things up and want to start over, you can always get rid of
any object you’ve created with a drop statement. The syntax is different for
tables and constraints.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;DROP TABLE&lt;/b&gt; &amp;lt;table name&amp;gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;ALTER TABLE&lt;/b&gt; &amp;lt;table name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;DROP
CONSTRAINT&lt;/b&gt; &amp;lt;constraint name&amp;gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
This is where consistent
constraint naming comes in handy, so you can just remember the PK or FK name
rather than remembering the syntax for looking up the names in another table.
The DROP TABLE statement gets rid of its own PK constraint, but won’t work
until you separately drop any FK constraints (or child tables) that refer to
this one. It also gets rid of all data that was contained in the table—and it
doesn&#39;t even ask you if you really want to do this!&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;All
of the information about objects in your schema is contained, not surprisingly,
in a set of tables that is called the&amp;nbsp;data dictionary. There are hundreds
of these tables most database systems, but all of them will allow you to see
information about your own tables, in many cases with a graphical interface.
How you do this is entirely system-dependent.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;u&gt;For Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;&quot;&gt;
&lt;b&gt;CREATE&lt;/b&gt; &lt;b&gt;TABLE&lt;/b&gt; My_table(&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; my_field1&amp;nbsp;&amp;nbsp; &lt;b&gt;INT&lt;/b&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-indent: .5in;&quot;&gt;
my_field2&amp;nbsp;&amp;nbsp; &lt;b&gt;VARCHAR&lt;/b&gt;(50),&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-indent: .5in;&quot;&gt;
my_field3&amp;nbsp;&amp;nbsp; &lt;b&gt;DATE&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;NOT&lt;/b&gt; &lt;b&gt;NULL&lt;/b&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-indent: .5in;&quot;&gt;
&lt;b&gt;PRIMARY&lt;/b&gt; &lt;b&gt;KEY&lt;/b&gt;
(my_field1, my_field2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;&quot;&gt;
);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-top: 12.0pt; text-indent: .5in;&quot;&gt;
&lt;b&gt;ALTER&lt;/b&gt; &lt;b&gt;TABLE&lt;/b&gt;
My_table &lt;b&gt;ADD&lt;/b&gt; my_field4 &lt;b&gt;NUMBER&lt;/b&gt;(3) &lt;b&gt;NOT&lt;/b&gt; &lt;b&gt;NULL&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-top: 12.0pt; text-indent: .5in;&quot;&gt;
&lt;b&gt;TRUNCATE&lt;/b&gt; &lt;b&gt;TABLE&lt;/b&gt;
My_table;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-top: 12.0pt; text-indent: .5in;&quot;&gt;
&lt;b&gt;DROP&lt;/b&gt; &lt;b&gt;TABLE&lt;/b&gt;
My_table;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-top: 12.0pt; text-indent: .5in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Mangal; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;mso-special-character: line-break; page-break-before: always;&quot; /&gt;
&lt;/span&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 16.0pt; line-height: 115%;&quot;&gt;Data Manipulation Language(DML)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
DML statements are used to work
with the data in tables. When you are connected to most multi-user databases
(whether in a client program or by a connection from a Web page script), you
are in effect working with a private copy of your tables that can’t be seen by
anyone else until you are finished (or tell the system that you are finished).
You have already seen the SELECT statement; it is considered to be part of DML
even though it just retrieves data rather than modifying it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo2; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;The
insert statement is used, obviously, to add new rows to a table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;INSERT
INTO&lt;/b&gt; &amp;lt;table name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;VALUES
&lt;/b&gt;(&amp;lt;value 1&amp;gt;, ... &amp;lt;value n&amp;gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
The comma-delimited list of
values must match the table structure exactly in the number of attributes and
the data type of each attribute. Character type values are always enclosed in
single quotes; number values are never in quotes; date values are often (but
not always) in the format &#39;yyyy-mm-dd&#39; (for example, &#39;2006-11-30&#39;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Yes, you will need a separate &lt;b&gt;INSERT&lt;/b&gt;
statement for every row.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 12.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;The update statement is used to change values
that are already in a table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-top: 12.0pt; mso-add-space: auto; text-align: justify;&quot;&gt;
&lt;b&gt;UPDATE&lt;/b&gt; &amp;lt;table name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;SET&lt;/b&gt;
&amp;lt;attribute&amp;gt; = &amp;lt;expression&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;WHERE&lt;/b&gt;
&amp;lt;condition&amp;gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
The update expression can be a
constant, any computed value, or even the result of a &lt;b&gt;SELECT&lt;/b&gt; statement
that returns a single row and a single column. If the &lt;b&gt;WHERE&lt;/b&gt; clause is
omitted, then the specified attribute is set to the same value in every row of
the table (which is usually not what you want to do). You can also set multiple
attribute values at the same time with a comma-delimited list of
attribute=expression pairs.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo2; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;3.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;The&amp;nbsp;delete&amp;nbsp;statement
does just that, for rows in a table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;DELETE
FROM &lt;/b&gt;&amp;lt;table name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;WHERE
&lt;/b&gt;&amp;lt;condition&amp;gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
If the &lt;b&gt;WHERE&lt;/b&gt; clause is
omitted, then every row of the table is deleted (which again is usually not
what you want to do)—and again, you will not get a “do you really want to do
this?” message.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo2; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;4.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;If
you are using a large multi-user system, you may need to make your DML changes
visible to the rest of the users of the database. Although this might be done
automatically when you log out, you could also just type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;COMMIT;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l1 level1 lfo2; text-align: justify; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;5.&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;If
you&#39;ve messed up your changes in this type of system, and want to restore your
private copy of the database to the way it was before you started (this only
works if you haven’t already typed &lt;b&gt;COMMIT&lt;/b&gt;), just type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;ROLLBACK&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Although single-user systems
don’t support&amp;nbsp;commit&amp;nbsp;and&amp;nbsp;rollback&amp;nbsp;statements, they are used
in large systems to control&amp;nbsp;transactions, which are sequences of changes
to the database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;u&gt;For Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;INSERT&lt;/b&gt; &lt;b&gt;INTO&lt;/b&gt; My_table&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (field1, field2, field3)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;VALUES&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&#39;test&#39;, &#39;N&#39;, &lt;b&gt;NULL&lt;/b&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;UPDATE&lt;/b&gt; My_table&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;SET&lt;/b&gt;
field1 = &#39;updated value&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;WHERE&lt;/b&gt; field2 = &#39;N&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;DELETE&lt;/b&gt; &lt;b&gt;FROM&lt;/b&gt; My_table&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;WHERE&lt;/b&gt; field2 = &#39;N&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;CREATE&lt;/b&gt; &lt;b&gt;TABLE&lt;/b&gt; tbl_1(id &lt;b&gt;INT&lt;/b&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;INSERT&lt;/b&gt; &lt;b&gt;INTO&lt;/b&gt; tbl_1(id) &lt;b&gt;VALUES&lt;/b&gt;(1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;INSERT&lt;/b&gt; &lt;b&gt;INTO&lt;/b&gt; tbl_1(id) &lt;b&gt;VALUES&lt;/b&gt;(2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;COMMIT&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;UPDATE&lt;/b&gt; tbl_1 &lt;b&gt;SET&lt;/b&gt; id=200 &lt;b&gt;WHERE&lt;/b&gt;
id=1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;SAVEPOINT&lt;/b&gt; id_1upd;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;UPDATE&lt;/b&gt; tbl_1 &lt;b&gt;SET&lt;/b&gt; id=1000 &lt;b&gt;WHERE&lt;/b&gt;
id=2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;ROLLBACK&lt;/b&gt; &lt;b&gt;TO&lt;/b&gt; id_1upd;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;SELECT&lt;/b&gt; id &lt;b&gt;FROM&lt;/b&gt; tbl_1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;START&lt;/b&gt; &lt;b&gt;TRANSACTION&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;UPDATE&lt;/b&gt; Account &lt;b&gt;SET&lt;/b&gt;
amount=amount-200 &lt;b&gt;WHERE&lt;/b&gt; account_number=1234;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;UPDATE&lt;/b&gt; Account &lt;b&gt;SET&lt;/b&gt;
amount=amount+200 &lt;b&gt;WHERE&lt;/b&gt; account_number=2345;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;IF&lt;/b&gt; ERRORS=0 &lt;b&gt;COMMIT&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in; text-align: justify; text-indent: .5in;&quot;&gt;
&lt;b&gt;IF&lt;/b&gt; ERRORS&amp;lt;&amp;gt;0 &lt;b&gt;ROLLBACK&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sgprogrammers.blogspot.com/feeds/3822797001137818710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sgprogrammers.blogspot.com/2012/10/ddl-and-dml-concepts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default/3822797001137818710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default/3822797001137818710'/><link rel='alternate' type='text/html' href='http://sgprogrammers.blogspot.com/2012/10/ddl-and-dml-concepts.html' title='DDL and DML Concepts'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/18053304515897945192</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2970226258851312603.post-1997961421313036842</id><published>2011-11-23T20:36:00.001+05:30</published><updated>2013-08-24T08:25:39.990+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interchanging Program in C"/><category scheme="http://www.blogger.com/atom/ns#" term="Swapping Program in C"/><title type='text'>Program to Swap or Interchange Two Numbers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
/*Program to swap or interchange two numbers.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt; Compiler Used &amp;nbsp; : Turbo C++ 4.5&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OS Used &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Windows 7&lt;/b&gt;&lt;br /&gt;
*/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
#include&amp;lt;iostream.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int a, b, temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;clrscr();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nEnter A: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;a;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nEnter B: &quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cin&amp;gt;&amp;gt;b;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;temp=a;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;a=b;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;b=temp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\n\nAfter Interchanging:&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nValue of A: &quot;&amp;lt;&amp;lt;a;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cout&amp;lt;&amp;lt;&quot;\nValue of B: &quot;&amp;lt;&amp;lt;b;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;getch();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpdUBjWotSnc0g0hYgdbUlfN961_EUUHcc94MfcLJ5tuZOl-B7gKqLc6IPyKHB3ORxPcPiw-PHysEUYK_l8ZhBu9LOiOh1XbyQ5gcU4YS-E1fwDzzfA1O4r0T1PGE2pzxEl_92WLJf9KPB/s1600/swap.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;132&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpdUBjWotSnc0g0hYgdbUlfN961_EUUHcc94MfcLJ5tuZOl-B7gKqLc6IPyKHB3ORxPcPiw-PHysEUYK_l8ZhBu9LOiOh1XbyQ5gcU4YS-E1fwDzzfA1O4r0T1PGE2pzxEl_92WLJf9KPB/s400/swap.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sgprogrammers.blogspot.com/feeds/1997961421313036842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sgprogrammers.blogspot.com/2011/11/program-to-swap-or-interchange-two.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default/1997961421313036842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default/1997961421313036842'/><link rel='alternate' type='text/html' href='http://sgprogrammers.blogspot.com/2011/11/program-to-swap-or-interchange-two.html' title='Program to Swap or Interchange Two Numbers'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/18053304515897945192</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpdUBjWotSnc0g0hYgdbUlfN961_EUUHcc94MfcLJ5tuZOl-B7gKqLc6IPyKHB3ORxPcPiw-PHysEUYK_l8ZhBu9LOiOh1XbyQ5gcU4YS-E1fwDzzfA1O4r0T1PGE2pzxEl_92WLJf9KPB/s72-c/swap.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2970226258851312603.post-2623613828390660036</id><published>2011-11-02T19:52:00.001+05:30</published><updated>2013-08-24T08:27:35.057+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Center Alignment In C"/><category scheme="http://www.blogger.com/atom/ns#" term="Center Alignment Program"/><category scheme="http://www.blogger.com/atom/ns#" term="Code for Alignment"/><category scheme="http://www.blogger.com/atom/ns#" term="Program to  Center Alignment in C"/><title type='text'>Text Alignment Programme - Central Alignment</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;//Programme for central alignment of text&lt;/b&gt;&lt;br /&gt;
/*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Compiler Used: Bordland Turbo 3.0&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OS Used&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Windows XP&lt;br /&gt;
*/&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;string.h&amp;gt;&lt;br /&gt;
#include&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
int c_align(char b[]);&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; char t1[40],t2[40],t3[40],t4[40];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; clrscr();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nTAG1: &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gets(t1);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nTAG2: &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gets(t2);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nTAG3: &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gets(t3);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\nTAG4: &quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gets(t4);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; clrscr();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gotoxy(c_align(t1),2);printf(&quot;%s&quot;,t1);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gotoxy(c_align(t2),3);printf(&quot;%s&quot;,t2);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gotoxy(c_align(t3),4);printf(&quot;%s&quot;,t3);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gotoxy(c_align(t4),5);printf(&quot;%s&quot;,t4);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; getch();&lt;br /&gt;
}&lt;br /&gt;
int c_align(char b[])&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int t_space=80,len=0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; len=strlen(b);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; t_space=t_space-len;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; t_space=t_space/2;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return t_space;&lt;br /&gt;
}&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbmrLrv4CqtViliLzjTgIeBJtpf6VIY4iYo7Bk8WmkO7eOz6leaXgx8EHxlRGF3qrE1O7CyU-1Pxwk_VUs3C6cjbXAsaIyyUXVKI-GUgPlLSHi2Yf65HipE91aTx_vvt_xr0Dtk2Jp-d1/s1600/CentreAlg.GIF&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;182&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbmrLrv4CqtViliLzjTgIeBJtpf6VIY4iYo7Bk8WmkO7eOz6leaXgx8EHxlRGF3qrE1O7CyU-1Pxwk_VUs3C6cjbXAsaIyyUXVKI-GUgPlLSHi2Yf65HipE91aTx_vvt_xr0Dtk2Jp-d1/s400/CentreAlg.GIF&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span id=&quot;goog_1217995739&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1217995740&quot;&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sgprogrammers.blogspot.com/feeds/2623613828390660036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sgprogrammers.blogspot.com/2011/11/text-alignment-programme-central.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default/2623613828390660036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2970226258851312603/posts/default/2623613828390660036'/><link rel='alternate' type='text/html' href='http://sgprogrammers.blogspot.com/2011/11/text-alignment-programme-central.html' title='Text Alignment Programme - Central Alignment'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/18053304515897945192</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbmrLrv4CqtViliLzjTgIeBJtpf6VIY4iYo7Bk8WmkO7eOz6leaXgx8EHxlRGF3qrE1O7CyU-1Pxwk_VUs3C6cjbXAsaIyyUXVKI-GUgPlLSHi2Yf65HipE91aTx_vvt_xr0Dtk2Jp-d1/s72-c/CentreAlg.GIF" height="72" width="72"/><thr:total>0</thr:total></entry></feed>