<?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-1396789838369464838</id><updated>2024-10-09T07:08:58.809+05:30</updated><category term="MySQL"/><category term="Boolean FULLTEXT Search"/><category term="Commit"/><category term="Database Storage"/><category term="Database Storage Engines"/><category term="Etag"/><category term="Indexing"/><category term="MYSQL FULLTEXT"/><category term="Natural Language FULLTEXT search"/><category term="NoSQL"/><category term="ORDER BY varchar field"/><category term="PostgreSQL"/><category term="Query Expansion Search"/><category term="RavenDB"/><category term="Replication"/><category term="Rollback"/><category term="Storage Engines"/><category term="Table Types"/><category term="Transaction"/><category term="Transaction Handling"/><category term="open source database"/><category term="server based database"/><title type='text'>SQL</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-7037306476728875833</id><published>2016-10-14T01:40:00.000+05:30</published><updated>2016-10-14T01:51:54.830+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Etag"/><category scheme="http://www.blogger.com/atom/ns#" term="Indexing"/><category scheme="http://www.blogger.com/atom/ns#" term="NoSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="RavenDB"/><category scheme="http://www.blogger.com/atom/ns#" term="Replication"/><title type='text'>NoSQL - RavenDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
NoSQL is a form of database, which is completely different from relational databases when talking in the terms of storing and retrieving data.&lt;br /&gt;
&lt;br /&gt;
There are many types of NoSQL databases being used in the market for varied requirements. I am speaking about RavenDB(open source) which is a document database.&lt;br /&gt;
&lt;br /&gt;
Calling it a document database, literally means that it stores data in the form of documents. Each document can be compared to a row of data in relational DBMS(related rows of data from multiple related tables).&lt;br /&gt;
&lt;br /&gt;
RavenDB is being used with .NET as of now. In general scenario, .NET developers will select data from table in the database, manipulate the data as per functionality (if required) and then inserts the data back into the table. This is the area where NoSQL is made use of.&lt;br /&gt;
&lt;br /&gt;
.NET developers need not reformat the data into table format anymore. They can store the JSON format files directly in the NoSQL (RavenDB) database.&lt;br /&gt;
&lt;br /&gt;
Each document will have metadata information like ETag, LastModified, Version etc. Each document will have unique ID like the primary key value in RDBMS for each row.&lt;br /&gt;
&lt;br /&gt;
A group of related documents is called a Collection.&lt;br /&gt;
&lt;br /&gt;
Indexing: We also have the feature of indexing. RavenDB implicitly creates indexes on the search criteria being used as and when necessary. We can also create explicit indexes.&lt;br /&gt;
&lt;br /&gt;
Replication: RavenDB supports replication. We can setup replication for required documents to move the data to SQL database for reporting purposes. We need to specify Destination table and a Document key from the Source Document collection and write code to map the document fields data to SQL table columns.&lt;br /&gt;
&lt;br /&gt;
Its good to see and learn a different form of database working alongside traditional RDBMSs.&lt;br /&gt;
&lt;br /&gt;
Happy NoSQLing!&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/7037306476728875833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2016/10/nosql-ravendb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/7037306476728875833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/7037306476728875833'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2016/10/nosql-ravendb.html' title='NoSQL - RavenDB'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-156325533918698107</id><published>2011-08-25T12:36:00.012+05:30</published><updated>2016-07-19T06:47:57.380+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Boolean FULLTEXT Search"/><category scheme="http://www.blogger.com/atom/ns#" term="MYSQL FULLTEXT"/><category scheme="http://www.blogger.com/atom/ns#" term="Natural Language FULLTEXT search"/><category scheme="http://www.blogger.com/atom/ns#" term="Query Expansion Search"/><title type='text'>MySQL FULLTEXT Searches</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #674ea7;&quot;&gt;&lt;span style=&quot;background-color: white; color: #cc0000; font-family: Verdana, sans-serif; font-size: small;&quot;&gt;Want
to search a particular string in MYSQL database? then make use of
Full Text Search techniques&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;There
are 3 types of Full Text Search techniques available:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;1.Natural
language Full-Text Search&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;2.Boolean
Full-Text Search&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;3.Query
Expansion Search&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;For
the above searches we make use of MATCH(col1,col2..) AGAINST(expr [IN
NATURAL LANGUAGE MODE/IN BOOLEAN MODE/WITH QUERY EXPANSION])&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;One
or more columns can be provided in the MATCH function. Search string
is given as argument to AGAINST function.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;u&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Natural
language Full-Text Search(is used by default)&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;u&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Boolean
Full-Text Search&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;u&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Query
Expansion Search&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Natural
language Full-Text Search can be applied only on MYISAM tables. For
performing the search we create an FULLTEXT index on the particular
columns to be searched. Non indexed columns cannot be searched.
FULLTEXT index can be created while creating a table or can be
altered later to add the index. It is better to first create a table,
upload the data and then add the index. This is because when large
data sets must be loaded to table, FULLTEXT indexed table takes
larger time.This search interprets the search string as a phrase in
natural language. There are no special operators.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;By
default the search is not case sensitive. To make search case
sensitive, we need to go for binary collation for the indexed
columns.For example, a column that uses the latin1 character set can
be assigned a collation of latin1_bin to make it case sensitive for
full-text searches.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;This
returns rows basing on the relevance. Relevance is calculated basing
on the number of times the search string occurs in a particular
row(from higher relevance to lower relevance).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;background-color: white; color: #cc0000; font-family: Verdana, sans-serif; font-weight: normal;&quot;&gt;Limitations:&lt;/span&gt;&lt;/u&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Words
that are present in 50% or more of the rows are considered common and
do not match&amp;nbsp;the selection.The stopword list applies.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Syntax:&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from table_name where MATCH(indexed columns seperated by comma)
AGAINST(SEARCH STRING IN &#39;&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Ex:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from test where MATCH(column1,column2) AGAINST(&#39;search string&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&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;OR&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from test where MATCH(column1,column2) AGAINST(&#39;search string&#39; IN
NATURAL LANGUAGE MODE);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;A
boolean search interprets the search string using the rules of a
special query language. The string contains the words to search for.
It can also contain operators that specify requirements such that a
word must be present or absent in matching rows, or that it should be
weighted higher or lower than usual. Common words such as “some”
or “then” are stopwords and do not match if present in the search
string.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;This
does not follow any relevance order as Natural Language Search.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Boolean
search can be performed even without creating an index on the
columns.But this type of search would be slow.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;This
does not have 50% matching criteria as of Natural Language Search.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;This
search makes use of following operators:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;A
leading plus indicates this word must&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;-&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;A
leading minus indicates that the rows returned must not contain the
specified word.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;[no
operator] implies optional&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Syntax:&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from table_name where MATCH(indexed columns seperated by comma)
AGAINST(SEARCH STRING IN &#39;&#39; IN BOOLEAN MODE);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Ex:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from test where MATCH(column1,column2) AGAINST(&#39;search string&#39; IN
BOOLEAN MODE);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;The&lt;/span&gt;&lt;em&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;Blind
Query Expansion (or automatic relevance feedback)&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;feature
can be used to expand the results of the search. This often includes
much more noise, and makes for a very fuzzy search.In most cases you
would use this operation if the users query returned just a few
results, you try it again withe query expansion&amp;nbsp;and it will add
words that are commonly found with the words in the query.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Syntax:&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from table_name where MATCH(indexed columns seperated by comma)
AGAINST(SEARCH STRING IN &#39;&#39; WITH QUERY EXPANSION);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Ex:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;select
* from test where MATCH(column1,column2) AGAINST(&#39;search string&#39; WITH
QUERY EXPANSION);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif; font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;u&gt;&lt;span style=&quot;background-color: white; color: #cc0000;&quot;&gt;FEW
IMPORTANT POINTS:&lt;/span&gt;&lt;/u&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Use
the following query to query the variables status related to FULL
TEXT search&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;show
variables like &#39;ft%&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Searches
 are not case sensitive.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;div style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-bottom: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Short
 words are ignored, the default minimum length is 4 characters. You&amp;nbsp;
 can change the min and max word length with the variables
 ft_min_word_len&amp;nbsp;and ft_max_word_len .&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;Words
 called&amp;nbsp;&lt;/span&gt;&lt;em&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;stopwords&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;are
 ignored, you can specify your own stopwords, but default words
 include&amp;nbsp;&lt;/span&gt;&lt;em&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;the&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;em&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;have&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;,&lt;/span&gt;&lt;em&gt;&lt;span style=&quot;font-style: normal;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;&quot;&gt;some&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-bottom: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;You
 can disable stopwords by setting the variable ft_stopword_file to an
 empty string.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-bottom: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;Full
 Text searching is only supported by the MYISAM&amp;nbsp;storage engine.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;margin-bottom: 0in; text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: Verdana, sans-serif;&quot;&gt;If
 a word is present in more than 50% of the rows it will have a weight
 of zero. This has advantages on large datasets, but can make testing
 difficult on small ones(applicable only to Natural language Search).&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/156325533918698107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2011/08/mysql-fulltext-searches.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/156325533918698107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/156325533918698107'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2011/08/mysql-fulltext-searches.html' title='MySQL FULLTEXT Searches'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-533593098664838665</id><published>2011-08-03T12:39:00.007+05:30</published><updated>2016-07-19T06:26:42.770+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="ORDER BY varchar field"/><title type='text'>Ordering on Varchar Datatype column</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
CAST function can be used like below:&lt;br /&gt;
&lt;br /&gt;
SELECT col_name from table_name&lt;br /&gt;
ORDER BY CAST(col_name AS SIGNED INT);&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;We just make the ORDER BY clause work on a integer value.That is done by&amp;nbsp;&lt;/span&gt;CAST(col_name AS SIGNED INT) in the statement.&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/533593098664838665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2011/08/ordering-on-varchar-field.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/533593098664838665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/533593098664838665'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2011/08/ordering-on-varchar-field.html' title='Ordering on Varchar Datatype column'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-6246906277131464543</id><published>2010-10-25T13:07:00.004+05:30</published><updated>2016-10-29T00:15:14.400+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Commit"/><category scheme="http://www.blogger.com/atom/ns#" term="Rollback"/><category scheme="http://www.blogger.com/atom/ns#" term="Transaction"/><category scheme="http://www.blogger.com/atom/ns#" term="Transaction Handling"/><title type='text'>Handling DatabaseTransactions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Transaction is a unit of work, when completed, takes the database from one stage to another.&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: left;&quot;&gt;&lt;span &gt;&lt;span  font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span  font-family: inherit;&quot;&gt;This post assumes the database to be MySQL and it is almost same in other databases too.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span  font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span  font-family: inherit;&quot;&gt;You will have 3 steps to do:&lt;/span&gt;&lt;br /&gt;
&lt;span  font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span  font-family: inherit;&quot;&gt;You need to begin a transaction,&amp;nbsp;&lt;/span&gt;&lt;span &quot;&gt;code required statements and&amp;nbsp;&lt;/span&gt;&lt;span &gt;end the transaction.&lt;/span&gt;&lt;br /&gt;
&lt;span  font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: left;&quot;&gt;&lt;span  font-family: inherit;&quot;&gt;&lt;b&gt;Step 1: Start the transaction:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span  font-family: inherit;&quot;&gt;Initiate a transaction by using BEGIN WORK command. When you issue this command, MySQL assumes that everything following it is part of a transaction&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: left;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 12pt; text-align: left;&quot;&gt;&lt;div style=&quot;line-height: normal;&quot;&gt;&lt;span  font-family: inherit;&quot;&gt;BEGIN WORK;&lt;/span&gt;&lt;br /&gt;
&lt;span  font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;line-height: normal;&quot;&gt;&lt;span  font-family: inherit;&quot;&gt;You can also use just BEGIN, or use the equivalent START TRANSACTION command.&lt;/span&gt;&lt;br /&gt;
&lt;span  font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;span  font-family: inherit;&quot;&gt;&lt;b&gt;Step 2: Perform the transaction&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span &gt;Once the transaction is start, use SQL commands as necessary. The dirty data visibility to other processes depends on the isolation level set for the database.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span  font-family: inherit;&quot;&gt;&lt;b&gt;Step 3: End the transaction&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 12pt; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span&gt;Once done with the SQL commands, you can either cancel the transaction or save the transaction to database.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span &gt;To cancel the transaction, use&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span  font-family: inherit;&quot;&gt;ROLLBACK command. It means when we issue ROLLBACK command, the database will go to the state before the BEGIN WORK command has been issued.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-family: inherit;&quot;&gt;To save the transaction, use COMMIT command. This statement will save all the changes to database done with the previous SQL commands.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: inherit;&quot;&gt;We also have a AUTOCOMMIT feature, which implicitly saves the changes. But do a research before setting it to ON/OFF.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span font-family: inherit;&quot;&gt;Source: http://www.weberdev.com/ViewArticle/Using-Transactions-In-MySQL-Part-1&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 12pt;&quot;&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span &gt;This article copyright&amp;nbsp;&lt;a href=&quot;http://www.weberdev.com/partners.php?out=1&amp;amp;ref=97&amp;amp;dest=http%3A%2F%2Fwww.melonfire.com%2Fcommunity%2Fcolumns%2Ftrog%2F&quot; target=&quot;BLANK&quot;&gt;Melonfire&lt;/a&gt;, 2005. All rights reserved.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #134f5c; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/6246906277131464543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2010/10/transactions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/6246906277131464543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/6246906277131464543'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2010/10/transactions.html' title='Handling DatabaseTransactions'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-3674322144096165237</id><published>2010-09-03T16:49:00.001+05:30</published><updated>2016-10-29T00:21:35.104+05:30</updated><title type='text'>Exception Handling in MySQL</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;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;b&gt;&lt;span 115=&quot;&quot; font-family:=&quot;&quot; line-height:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; verdana=&quot;&quot;&gt;&lt;span style=&quot;color: #cc0000; font-size: medium;&quot;&gt;Exception Handling&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;b&gt;&lt;span 115=&quot;&quot; font-family:=&quot;&quot; line-height:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; verdana=&quot;&quot;&gt;&lt;span style=&quot;color: #cc0000; font-size: medium;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt; &lt;span font-family:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; verdana=&quot;&quot;&gt;Exception Handling is a technique which helps smooth execution of code in case of any known/unknown issues &lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span 115=&quot;&quot; font-family:=&quot;&quot; line-height:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; verdana=&quot;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&lt;b&gt;Declare for Conditions&lt;/b&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span 115=&quot;&quot; font-family:=&quot;&quot; line-height:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; verdana=&quot;&quot;&gt;Certain conditions may require specific handling. These conditions can relate to errors or warnings, as well as to general flow control inside a stored program. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;General: Here we declare a specific name to a specific error number. These error numbers are pre-defined mysql errors. When a particular error number exception occurs, the condition associated is fired and relating actions are done.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Syntax&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;DECLARE&lt;/b&gt; &lt;i&gt;condition_name&lt;/i&gt; &lt;b&gt;CONDITION FOR&lt;/b&gt; &lt;i&gt;condition_value;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&lt;i&gt;condition_value&lt;/i&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQLSTATE [VALUE] &lt;i&gt;sqlstate_value&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&amp;nbsp; | &lt;i&gt;mysql_error_code&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;The &lt;code&gt;DECLARE ... CONDITION&lt;/code&gt; statement defines a named error condition. It specifies a condition that needs specific handling and associates a name with that condition. The name can be referred to in a subsequent &lt;code&gt;DECLARE ... HANDLER&lt;/code&gt; statement.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;A &lt;code&gt;&lt;i&gt;condition_value&lt;/i&gt;&lt;/code&gt; for &lt;code&gt;DECLARE ... CONDITION&lt;/code&gt; can be an SQLSTATE value (a 5-character string literal) or a MySQL error code (a number). You should not use SQLSTATE value &lt;code&gt;&#39;00000&#39;&lt;/code&gt; or MySQL error code 0, because those indicate success rather than an error condition. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;Below is an Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; font-family:=&quot;&quot; font-size:=&quot;&quot; quot=&quot;&quot; sans-serif=&quot;&quot; small=&quot;&quot; verdana=&quot;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;We have a table s1 as follows with ‘s’ as primary key&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: medium none;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;border: 1pt solid black; padding: 0in 5.4pt;&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin: 0in 0in 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;s&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;   &lt;td style=&quot;border-color: black black black -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt;&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;sname&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black black; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black black -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;Name1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black black; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black black -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;Name2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black black; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black black -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;Now try to insert a row with values (1,’name3’). We interpret it with the procedure&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;CREATE PROCEDURE&lt;/b&gt; p1 (&lt;b&gt;IN &lt;/b&gt;p_s int (2),&lt;b&gt; IN&lt;/b&gt; p_sname varchar (5), &lt;b&gt;OUT&lt;/b&gt; p_status varchar (30))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;DECLARE&lt;/b&gt; &lt;i&gt;duplicates &lt;/i&gt;&lt;b&gt;CONDITION FOR SQLSTATE &#39;23000&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;DECLARE EXIT HANDLER FOR SQLEXCEPTION&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;SET&lt;/b&gt; p_status =&#39;Out in middle&#39;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;END;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;Insert into s1 values (p_s, p_sname);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;END;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;Execute&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Call &lt;/b&gt;p1 (1,&#39;name3&#39;, @s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Select&lt;/b&gt; @s;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;OUTPUT:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;Out in middle&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;In the above procedure we declared a condition for duplicates.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;i.e. for returning a message when we try to insert duplicate values&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;code&gt;DECLARE&lt;/code&gt; for Handlers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=1396789838369464838&amp;amp;postID=3674322144096165237&quot; name=&quot;id3131971&quot;&gt;&lt;/a&gt;&lt;b&gt;DECLARE&lt;/b&gt; &lt;code&gt;&lt;i&gt;handler_type&lt;/i&gt;&lt;/code&gt; &lt;b&gt;HANDLER&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;FOR&lt;/b&gt; &lt;code&gt;&lt;i&gt;condition_value&lt;/i&gt;&lt;/code&gt; [, &lt;code&gt;&lt;i&gt;condition_value&lt;/i&gt;&lt;/code&gt;] ...&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;code&gt;&lt;i&gt;statement&lt;/i&gt;&lt;/code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;o:p style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;code&gt;&lt;i&gt;handler_type&lt;/i&gt;&lt;/code&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CONTINUE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | EXIT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | UNDO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;o:p style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;code&gt;&lt;i&gt;condition_value&lt;/i&gt;&lt;/code&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQLSTATE [VALUE] &lt;code&gt;&lt;i&gt;sqlstate_value&lt;/i&gt;&lt;/code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | &lt;code&gt;&lt;i&gt;condition_name&lt;/i&gt;&lt;/code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | SQLWARNING&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | NOT FOUND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | SQLEXCEPTION&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp; | &lt;code&gt;&lt;i&gt;mysql_error_code&lt;/i&gt;&lt;/code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;The &lt;code&gt;&lt;b&gt;DECLARE&lt;/b&gt;&lt;/code&gt;&lt;code&gt; ... &lt;b&gt;HANDLER&lt;/b&gt;&lt;/code&gt; statement specifies handlers that each may deal with one or more conditions. If one of these conditions occurs, the specified &lt;code&gt;&lt;b&gt;&lt;i&gt;statement&lt;/i&gt;&lt;/b&gt;&lt;/code&gt; is executed. &lt;code&gt;&lt;b&gt;&lt;i&gt;Statement&lt;/i&gt;&lt;/b&gt;&lt;/code&gt; can be a simple statement (for example, &lt;code&gt;&lt;b&gt;SET&lt;/b&gt;&lt;/code&gt;&lt;code&gt; &lt;b&gt;&lt;i&gt;var_name&lt;/i&gt; = &lt;i&gt;value&lt;/i&gt;&lt;/b&gt;&lt;/code&gt;), or it can be a compound statement written using &lt;code&gt;BEGIN&lt;/code&gt; and &lt;code&gt;END&lt;/code&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;For a &lt;code&gt;&lt;b&gt;CONTINUE&lt;/b&gt;&lt;/code&gt; handler, execution of the current program continues after execution of the handler statement. For an &lt;code&gt;&lt;b&gt;EXIT&lt;/b&gt;&lt;/code&gt; handler, execution terminates for the&lt;b&gt; &lt;/b&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/begin-end.html&quot; title=&quot;12.7.1. BEGIN ... END
      Compound Statement Syntax&quot;&gt;&lt;code&gt;&lt;b&gt;BEGIN ... END&lt;/b&gt;&lt;/code&gt;&lt;/a&gt; compound statement in which the handler is declared. (This is true even if the condition occurs in an inner block.) The &lt;code&gt;&lt;b&gt;UNDO&lt;/b&gt;&lt;/code&gt; handler type statement is not supported. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;If a condition occurs for which no handler has been declared, the default action is &lt;code&gt;&lt;b&gt;EXIT&lt;/b&gt;&lt;/code&gt;&lt;b&gt;.&lt;/b&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;A &lt;code&gt;&lt;b&gt;&lt;i&gt;condition_value&lt;/i&gt;&lt;/b&gt;&lt;/code&gt; for &lt;code&gt;&lt;b&gt;DECLARE ... HANDLER&lt;/b&gt;&lt;/code&gt; can be any of the following values: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;·&lt;span style=&quot;font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;An &lt;b&gt;SQLSTATE&lt;/b&gt; value (a 5-character string literal) or a &lt;b&gt;MySQL error code&lt;/b&gt; (a number). You should not use &lt;b&gt;SQLSTATE&lt;/b&gt; value &lt;code&gt;&#39;00000&#39;&lt;/code&gt; or &lt;b&gt;MySQL error code&lt;/b&gt; 0, because those indicate success rather than an error condition.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Create&lt;/b&gt; &lt;b&gt;procedure&lt;/b&gt; p1 (&lt;b&gt;in&lt;/b&gt; p_s int (2), &lt;b&gt;in&lt;/b&gt; p_sname varchar (5), &lt;b&gt;out&lt;/b&gt; p_status varchar (30))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;Begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;Declare Continue handler for SQLSTATE &#39;23000&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;Begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.75in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Set&lt;/b&gt; p_status = &lt;b&gt;&#39;In SQLSTATE 23000&#39;&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;End;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Insert into&lt;/b&gt; s1 &lt;b&gt;Values &lt;/b&gt;(p_s, p_sname);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;desc s1;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;End;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Call P1 &lt;/b&gt;(2,&#39;name3&#39;,@s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Select @S&lt;/b&gt;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;Output&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5pt; margin-left: 0.25in; margin-right: 0in; margin-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;In SQLSTATE 23000&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 5pt; text-align: center; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Null &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Default&amp;nbsp;&amp;nbsp; Extra&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; style=&quot;margin-bottom: 0.0001pt; margin-left: 0.25in; margin-right: 0in; margin-top: 5pt; text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 1.75in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int(2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NO&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;PRI &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5pt; margin-left: 1.5in; margin-right: 0in; margin-top: 0in; text-indent: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;sname&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varchar(5) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;YES&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;The example associates a handler with SQLSTATE value &lt;code&gt;&#39;23000&#39;&lt;/code&gt;, which occurs for a duplicate-key error. Notice that p_status is &lt;b&gt;In SQLSTATE 23000&lt;/b&gt; after the procedure executes, and the describe command shows the structure of the table, which shows that execution continued to the end of the procedure. If the &lt;code&gt;&lt;b&gt;DECLARE ... HANDLER&lt;/b&gt;&lt;/code&gt; statement had not been present, MySQL would have taken the default path (&lt;code&gt;EXIT&lt;/code&gt;) after the second &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/insert.html&quot; title=&quot;12.2.5. INSERT Syntax&quot;&gt;&lt;code&gt;INSERT&lt;/code&gt;&lt;/a&gt; failed due to the &lt;code&gt;PRIMARY KEY&lt;/code&gt; constraint.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;·&lt;span style=&quot;font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;A condition name previously specified with &lt;code&gt;&lt;b&gt;DECLARE ... CONDITION&lt;/b&gt;&lt;/code&gt;&lt;b&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;See Declare for Conditions Example Above&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;·&lt;span style=&quot;font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;code&gt;&lt;b&gt;SQLWARNING&lt;/b&gt;&lt;/code&gt; is shorthand for the class of SQLSTATE values that begin with &lt;code&gt;&#39;01&#39;&lt;/code&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;·&lt;span style=&quot;font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;code&gt;&lt;b&gt;NOT FOUND&lt;/b&gt;&lt;/code&gt; is shorthand for the class of SQLSTATE values that begin with &lt;code&gt;&#39;02&#39;&lt;/code&gt;. This is relevant only within the context of cursors and is used to control what happens when a cursor reaches the end of a data set. If no more rows are available, a No Data condition occurs with SQLSTATE value 02000. To detect this condition, you can set up a handler for it (or for a &lt;code&gt;NOT FOUND&lt;/code&gt; condition). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;·&lt;span style=&quot;font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;This condition also occurs for &lt;code&gt;SELECT ... INTO &lt;i&gt;var_list&lt;/i&gt;&lt;/code&gt; statements that retrieve no rows. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;·&lt;span style=&quot;font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;code&gt;&lt;b&gt;SQLEXCEPTION&lt;/b&gt;&lt;/code&gt; is shorthand for the class of SQLSTATE values that do not begin with &lt;code&gt;&#39;00&#39;&lt;/code&gt;, &lt;code&gt;&#39;01&#39;&lt;/code&gt;, or &lt;code&gt;&#39;02&#39;&lt;/code&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;If you want to ignore a condition, you can declare a &lt;code&gt;CONTINUE&lt;/code&gt; handler for it and associate it with an empty block. For example: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;DECLARE CONTINUE HANDLER FOR SQLWARNING BEGIN END;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;o:p style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;Source:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: small;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/declare-handler.html&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;http://dev.mysql.com/doc/refman/5.0/en/declare-handler.html&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/3674322144096165237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2010/09/exception-handling-in-mysql.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/3674322144096165237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/3674322144096165237'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2010/09/exception-handling-in-mysql.html' title='Exception Handling in MySQL'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-8707892911407414424</id><published>2010-05-11T11:21:00.002+05:30</published><updated>2016-07-19T06:33:11.218+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="open source database"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="server based database"/><title type='text'>Open Source Database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #cc0000; font-family: Verdana, sans-serif; font-weight: bold;&quot;&gt;What is Open Source&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Open Source software is available for free, and the source code is also available. This means that you (or others) can see how the software was actually programmed and change it, if you wish. That is, the user is allowed to implement, share and further develop the database software to suit various needs.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The &lt;span style=&quot;font-weight: bold;&quot;&gt;advantage&lt;/span&gt; of freely available software is obvious, but why is the source code availability important? Open Source software products are most often the collective effort of many volunteer programmers. Anyone can submit bug fixes, security patches, and the like. This means that bugs get fixed faster, programs are more secure, and, in general, as a program matures, it is of higher quality.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;One of the primary&lt;span style=&quot;font-weight: bold;&quot;&gt; disadvantages&lt;/span&gt; of open source software is that it can be user-unfriendly, and it may be difficult to find someone with expertise in the software to set it up for an organization.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #cc0000; font-family: Verdana, sans-serif; font-weight: bold;&quot;&gt;What are Server-Based Databases&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Server-based databases differ from database management systems such as FileMaker Pro and Microsoft Access, which are primarily designed as stand-alone desktop databases for a single user. In contrast, server-based databases, such as MySQL, PostgreSQL, Microsoft SQL Server, and Oracle, are designed to be used on servers instead of on a desktop, and they are meant to be shared by many users. Technically, multiple users can share FileMaker Pro and Access, but as the number of users increases (along with the number of requests for information) performance suffers greatly. That is why a server-based database is a common choice for organizations where many people need to share data.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #cc0000; font-family: Verdana, sans-serif; font-weight: bold;&quot;&gt;MySQL and PostgreSQL&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;MySQL and PostgreSQL&amp;nbsp;are two primary Open Source server-based database management systems in use. Both of these database systems run well on UNIX-based operating systems, such as Linux, as well as Windows. In general, however, UNIX is the better OS for multi-user database applications because of its stability and scalability.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Primarily cost, stability, and security are the reasons to choose an Open Source server-based database management package, rather than, for example, Microsoft&#39;s SQL server. Both MySQL and PostgreSQL are freely available, fairly easy to set up, and more secure than Microsoft&#39;s SQL Server.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The most common use of server-based DBMS in the nonprofit sector is for Web-based databases. Many nonprofits use server-based DBMS for their interactive Web sites, providing data and content to their constituencies. MySQL is probably the most common of the Open Source database systems used for Web sites because almost all virtual hosting companies provide it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Another common use of server-based DBMS is to underlie large shared databases, such as client management databases and financial packages.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;What if you are already using Access at your organization? You can set up a Linux-based database with either MySQL or PostgreSQL, and use an ODBC (Open Data Base Connectivity) connection between the desktop Access databases and the server database. This means that on the front-end, your users can still use Access, but the back-end is more robust and secure, because it is server-based.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #cc0000; font-family: Verdana, sans-serif; font-weight: bold;&quot;&gt;Should you use MySQL or PostgreSQL?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;MySQL is simpler and smaller, and therefore generally faster than PostgreSQL. It is also the better choice for Web-based use, as MySQL is most often the only DBMS available in virtual hosting accounts. In addition, there are more users of MySQL, so it would be easier to find someone to help you set it up and work with it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;However, PostgreSQL is much more robust, scalable, and standards compliant and it can handle multiple transactions easily.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In conclusion, both PostgreSQL and MySQL are freely available, stable, robust, and secure database management systems, provide a clear, inexpensive way to design and implement server-based databases. Through a variety of methods, such as Web-based interfaces, Access front ends, or custom designed GUIs, these DBMS can be used easily, in a multi-platform environment.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/8707892911407414424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2010/05/open-source-database.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/8707892911407414424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/8707892911407414424'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2010/05/open-source-database.html' title='Open Source Database'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1396789838369464838.post-7402963257387586539</id><published>2010-05-10T15:21:00.001+05:30</published><updated>2016-07-19T06:31:08.239+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database Storage"/><category scheme="http://www.blogger.com/atom/ns#" term="Database Storage Engines"/><category scheme="http://www.blogger.com/atom/ns#" term="Storage Engines"/><category scheme="http://www.blogger.com/atom/ns#" term="Table Types"/><title type='text'>Database Storage Engines</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #cc0000; font-weight: bold;&quot;&gt;Database Storage Engines:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Database Storage Engines are programs that are integrated into MySQL database management system to manage data tables. Database Storage Engines are also called Table Types.&lt;br /&gt;&lt;br /&gt;Data in MySQL is stored in files (or memory) using a variety of different techniques. Each of these techniques employ different storage mechanisms, indexing facilities, locking levels and ultimately provide a range of different functions and capabilities. By choosing a different technique you can gain additional speed or functionality benefits that will improve the overall functionality of your application.&lt;br /&gt;&lt;br /&gt;For example, if you work with a large amount of temporary data, you may want to make use of the MEMORY storage engine, which stores all of the table data in memory. Alternatively, you may want a database that supports transactions (to ensure data resilience).&lt;br /&gt;&lt;br /&gt;Each of these different techniques and suites of functionality within the MySQL system is referred to as a storage engine (also known as a table type). By default, MySQL comes with a number of different storage engines pre-configured and enabled in the MySQL server. You can select the storage engine to use on a server, database and even table basis, providing you with the maximum amount of flexibility when it comes to choosing how your information is stored, how it is indexed and what combination of performance and functionality you want to use with your data.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Benefits of Database Storage Engines&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-weight: bold;&quot;&gt;Availability&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;Reliability and concurrency are enhanced with new algorithms for physical file interaction. These algorithms eliminate the need to run database console commands (DBCCs) as part of regular maintenance. However, DBCC is still available, and the new DBCC CHECK commands can be run without inhibiting online processing.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Scalability&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;The storage subsystem, which consists of the physical database files and their layout on disk, supports scaling from very small to very large databases. SQL Server can now support up to 64 GB of physical memory (RAM) and up to 32 processors.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Ease of use&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;Enhanced administration capabilities help the Database Administrator (DBA) to automate and centralize server management. This also allows easy maintenance of remote servers and applications without the necessity of having a DBA visit every site. Server configuration, managed by a sophisticated algorithm, is dynamically responsive to server usage patterns, freeing the DBA to concentrate on database management and optimization tasks.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Here are listed a few types of Database Storage Engines&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;MyISAM Storage Engine&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;–&lt;/span&gt; MySQL default storage engine. Based on ISAM database concept. MyISAM is not transaction safe.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;Innodb Storage Engine – &lt;/span&gt;A transaction safe storage engine developed by Innobase Oy (an Oracle company).&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;BDB (BerkeleyDB) Storage Engine –&lt;/span&gt; A transaction safe storage engine originally developed at U.C. Berkeley. Sleepycat Software, Inc. was created in 1996 to continue BDB development. Sleepycat is an Oracle company now.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;CSV Storage Engine –&lt;/span&gt; A simple storage engine storing data as text files using comma-separated values format.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;MEMORY (HEAP) Storage Engine –&lt;/span&gt; A storage engine storing data in computer main memory.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;BLACKHOLE –&lt;/span&gt; A  /dev/null storage engine (anything you write to it disappears)&lt;br /&gt;We also have many other types of Database Storage Engines available for use.&lt;br /&gt;&lt;br /&gt;To see the MySQL storage engines available on your server, use the show engines statement:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;show engines;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;However, in the output, only if DEFAULT or YES appears in the “Support” column is an engine available for use.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gowthamigadde.blogspot.com/feeds/7402963257387586539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gowthamigadde.blogspot.com/2010/05/database-storage-engines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/7402963257387586539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1396789838369464838/posts/default/7402963257387586539'/><link rel='alternate' type='text/html' href='http://gowthamigadde.blogspot.com/2010/05/database-storage-engines.html' title='Database Storage Engines'/><author><name>Gowthami Gadde</name><uri>http://www.blogger.com/profile/12824233960824638833</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVdYtGsz8fVUXpRUQZT3w-q8GA_cWH3_XNreqIoONIj_oNV9DlhvylzCS0s6IhKvlkHNxmLXt89b7K8ulz2euJl3I1H7qanMNGxor8zM7aSxjUWy1J2mTtjvqJsA675g/s64/Cube.ico'/></author><thr:total>0</thr:total></entry></feed>