<?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-2631787733157331720</id><updated>2024-08-29T09:29:12.823-04:00</updated><title type='text'>SQL Tutorial</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-1422449900851771139</id><published>2010-09-03T23:44:00.002-04:00</published><updated>2010-09-03T23:44:30.806-04:00</updated><title type='text'>SSRS (SQL Server Reporting Services)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;SQL Server&amp;nbsp;Reporting Services provides a full range of ready-to-use  tools and services to help you create, deploy, and manage reports for  your organization, as well as programming features that enable you to  extend and customize your reporting functionality. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Reporting  Services&amp;nbsp;is a server-based reporting platform that provides  comprehensive reporting functionality for&amp;nbsp;a variety of data sources.  Reporting Services includes a complete set of tools for&amp;nbsp;you to create,  manage, and deliver reports, and APIs that enable&amp;nbsp;developers to  integrate or extend data and report processing in custom  applications.&amp;nbsp;Reporting Services tools work within the Microsoft&amp;nbsp;Visual  Studio environment and are fully integrated with SQL Server tools and  components.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;With Reporting Services, you can create interactive,  tabular, graphical, or free-form reports from relational,  multidimensional, or XML-based data sources. You can publish reports,  schedule report processing, or access reports on-demand. Reporting  Services also enables you&amp;nbsp;to create ad hoc reports based on predefined  models, and to interactively explore data within the model. You can  select from a variety of viewing formats, export reports to other  applications, and subscribe to published reports. The reports that you  create can be viewed over a Web-based connection or as part of a  Microsoft Windows application or SharePoint site.&amp;nbsp;Reporting Services  provides the key to your business data.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/1422449900851771139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/09/ssrs-sql-server-reporting-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/1422449900851771139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/1422449900851771139'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/09/ssrs-sql-server-reporting-services.html' title='SSRS (SQL Server Reporting Services)'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-4219340734073599765</id><published>2010-09-02T22:13:00.006-04:00</published><updated>2010-09-02T22:20:34.696-04:00</updated><title type='text'>SQL CMD Utility</title><content type='html'>&lt;h2 style=&quot;text-align: justify;&quot;&gt;What is XP_CMDSHELL ?&lt;/h2&gt;&lt;div class=&quot;entry&quot; style=&quot;text-align: justify;&quot;&gt;XP_CMDSHELL -  extended stored procedure.&lt;br /&gt;
With this extended stored procedure you have the ability to &lt;b&gt;run any command line process within your SQL script&lt;/b&gt;, so you can embed this within your stored procedures, jobs or batch processing.&lt;br /&gt;
In&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt; &lt;span style=&quot;color: black; font-size: small;&quot;&gt;SQL Server 2000&lt;/span&gt;&lt;/b&gt;&lt;/span&gt; this option&lt;b style=&quot;color: black;&quot;&gt; &lt;b&gt;is enabled by default&lt;/b&gt;&lt;/b&gt;, but to limit access to using xp_cmdshell only members of the sysadmin server role have default rights.&lt;br /&gt;
To extend rights to other users &lt;b style=&quot;color: black;&quot;&gt;you can use the GRANT statement to allow execute rights.&lt;/b&gt;&lt;br /&gt;
With&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt; &lt;span style=&quot;color: black;&quot;&gt;SQL Server 2005&lt;/span&gt;&lt;/b&gt;&lt;/span&gt; the use of&lt;b&gt; &lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;xp_cmdshell is turned off by default&lt;/b&gt;.&lt;/span&gt;  As SQL Server continues to mature Microsoft has put many safeguards in  place to minimize the security risks of unwanted code being executed  within SQL Server or outside of SQL Server.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Examples of XP_SMDSHELL Commands&lt;/h2&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1) XP_CMDSHELL Directory Search&lt;/b&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;For example. If the User dose not have  access to the physical SQL Server machine, but if he want to &lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;see all the files in the “C:\temp” directory that have a “.sql” extension&lt;/span&gt;.&lt;/b&gt; He can do this by issuing the following command: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;exec master.dbo.xp_cmdshell ‘dir c:\temp\*.sql’&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2) Create a new directory using XP_CMDSHELL &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;This is the simple example Imagine a user is in process of building a new &lt;b&gt;SQL Agent job&lt;/b&gt; using Enterprise Manager.  &lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;To  organize the output from all the steps in this new job, he want the  output of each step to go into a common directory on the server, where  each step has its own output file.&lt;/span&gt;&lt;/b&gt; The only problem is the new  directory does not exist.  here we assume that used do not have access to the server,  or do not want to walk down the hall to the computer room to create this  new directory.  No problem he can just enter the following command in  Query Analyzer from the privacy of your office to accomplish creating  the new directory: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;exec master.dbo.xp_cmdshell ‘mkdir “c:\temp\SQL Agent Output\new_job\*&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;b&gt;3) Run DTS package via stored procedure using XP_CMDSHELL&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;As you can see, &lt;span style=&quot;color: black;&quot;&gt;it is very easy to execute DOS commands using xp_cmdshell.  So can xp_cmdshell also run executables?  The answer is &lt;b&gt;YES!&lt;/b&gt;  Suppose &lt;b&gt;you have a DTS Package that you want to run via a stored procedure&lt;/b&gt;&lt;/span&gt;.  There is no “sp_executeDTS” stored procedure, but you can use the following xp_cmdshell command to run your DTS package:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;exec master.dbo.xp_cmdshell ‘dtsrun -E -Sserver1 -N”Export Invoices”‘&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,Arial,Helvetica,sans-serif;&quot;&gt;&lt;b&gt;Note :&lt;/b&gt;This command executed the &lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;“dtsrun”&lt;/b&gt;&lt;/span&gt;  executable with the necessary parameters to run the “Export Invoices”  DTS package.  Are you starting to see how the xp_cmdshell extented store  procedure can provide you with some alternatives and also expands the  functionality you can build into a T-SQL script.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/4219340734073599765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/09/sql-cmd-utility.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/4219340734073599765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/4219340734073599765'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/09/sql-cmd-utility.html' title='SQL CMD Utility'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-3143252974120321230</id><published>2010-09-01T18:36:00.001-04:00</published><updated>2010-09-01T18:37:06.400-04:00</updated><title type='text'>CTE [Common Table Expression]</title><content type='html'>&lt;div class=&quot;introduction&quot; style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Overview :&amp;nbsp;&lt;/b&gt; &lt;br /&gt;
A common table expression (CTE) can be  thought of as a temporary result set that is defined within the  execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE  VIEW statement. A CTE is similar to a derived table in that it is not  stored as an object and lasts only for the duration of the query. Unlike  a derived table, a CTE can be self-referencing and can be referenced  multiple times in the same query.&lt;br /&gt;
A CTE can be used to:  &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Create a recursive query. &lt;/li&gt;
&lt;li&gt;Substitute  for a view when the general use of a view is not required; that is, you  do not have to store the definition in metadata.&lt;/li&gt;
&lt;li&gt;Enable  grouping by a column that is derived from a scalar subselect, or a  function that is either not deterministic or has external access.&lt;/li&gt;
&lt;li&gt;Reference the resulting table multiple times in the same statement.&lt;/li&gt;
&lt;/ul&gt;Using  a CTE offers the advantages of improved readability and ease in  maintenance of complex queries. The query can be divided into separate,  simple, logical building blocks. These simple blocks can then be used to  build more complex, interim CTEs until the final result set is  generated. &lt;br /&gt;
CTEs can be defined in user-defined routines, such as functions, stored procedures, triggers, or views.&lt;/div&gt;&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Structure of a CTE&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; style=&quot;margin-left: 0px; margin-right: 0px;&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;b&gt;Example :&lt;/b&gt; &lt;br /&gt;
A  CTE is made up of an expression name representing the CTE, an optional  column list, and a query defining the CTE. After a CTE is defined, it  can be referenced like a table or view can in a SELECT, INSERT, UPDATE,  or DELETE statement. A CTE can also be used in a CREATE VIEW statement  as part of its defining SELECT statement. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;The basic syntax structure for a CTE is:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;span class=&quot;code&quot;&gt;WITH expression_name [ ( column_name [,...n] ) ]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;span class=&quot;code&quot;&gt;AS&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;span class=&quot;code&quot;&gt;( CTE_query_definition )&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;The list of column names is optional only if distinct names for all resulting columns are supplied in the query definition.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;The statement to run the CTE is:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;span class=&quot;code&quot;&gt;SELECT &amp;lt;column_list&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;span class=&quot;code&quot;&gt;FROM expression_name;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/3143252974120321230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/09/cte-common-table-expression.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/3143252974120321230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/3143252974120321230'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/09/cte-common-table-expression.html' title='CTE [Common Table Expression]'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-742654584347245632</id><published>2010-08-31T16:23:00.000-04:00</published><updated>2010-08-31T16:23:56.926-04:00</updated><title type='text'>Types of License for SQL Server</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Enterprise leverages the power of the Microsoft® SQL Server (MS-SQL) platform. Microsoft SQL Express is the native database management system for the network fax solution. Microsoft SQL Express enables customers to effortlessly make use of the product ‘out of the box’, while allowing database scalability through&lt;br /&gt;
seamless migration to MS-SQL Server if required to meet greater storage demands or to integrate with existing installations.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In cases where the capacity constraints inherent in SQL Express may be a limiting factor with regard to a customer’s unique needs, it is recommended that the licensed server edition, Microsoft SQL Server, be utilized. MS-SQL Server is based on product licensing, which can be arranged with a Certified Microsoft Product Reseller.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; There are several types of licensing models for MS-SQL Server. Each model addresses different computing environments, from a handful of users or seats, to multiple server processor models with a large number of users requiring MS-SQL access.&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;License Types&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
There are three MS-SQL license types, detailed as follows:&lt;/div&gt;&lt;ul style=&quot;text-align: justify;&quot;&gt;&lt;li&gt;&amp;nbsp;Server License: For the Server running MS-SQL&lt;/li&gt;
&lt;li&gt;Client Access License (CAL): For the user or device accessing MS-SQL&lt;/li&gt;
&lt;li&gt;&amp;nbsp;Processor License: Per physical or virtual processor being used to run the MS-SQL instance&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Licensing Models&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There are three MS-SQL licensing models where the abovementioned license types are used:&lt;/div&gt;&lt;ul style=&quot;text-align: justify;&quot;&gt;&lt;li&gt;Processor Based Licensing&lt;/li&gt;
&lt;li&gt;Server License + User CAL&lt;/li&gt;
&lt;li&gt;Server License + Device CAL&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Process or Based Licensing&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Processor based licensing is based on the number of (physical or virtual) processors designated in an operating system to running MS-SQL Server. Obtaining the license for this model alleviates the need to license each individual device or user that will need to access MS-SQL. In short, this type of license enables an unlimited number of users and/or devices to access MS-SQL.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For multi-core central processing units (CPU), licensing remains based on the number of CPUs, not on the number of CPU cores. Processor based licensing is available for Enterprise, Standard and Workgroup editions of MS-SQL. Limitations are placed on how many CPUs are supported by each SQL server version.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Server + User CALs&lt;/b&gt;&lt;br /&gt;
The CAL is similar to the legacy licensing model of most software. Licensing is based on the individual user of the software, or in the case of MS-SQL, the user who accesses the database. In addition to the individual user CAL, a server license must be purchased in addition to the total number of user CALs. This type of CAL grants user access to multiple MS-SQL Servers.&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Server + Device CALs&lt;/b&gt;&lt;br /&gt;
As most devices became network aware, (for instance cell phones, PDAs, etc.), Microsoft created the Server + Device CALs licensing model. This licensing model is based on the Server + User CALs model; however the license in this case applies to a device, as opposed to a user. This type of license is most effective in cases where users share the same device (terminal or PC). In line with the Server + User CALs, the Server + Device CALs licensing model also requires a separate license for each MS-SQL server.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/742654584347245632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/types-of-license-for-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/742654584347245632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/742654584347245632'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/types-of-license-for-sql-server.html' title='Types of License for SQL Server'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-8353260451657803828</id><published>2010-08-30T18:51:00.000-04:00</published><updated>2010-08-30T18:51:37.520-04:00</updated><title type='text'>Entity Relationship Diagram</title><content type='html'>&lt;div&gt;&lt;b&gt;Definition: &lt;/b&gt;An entity-relationship (ER) diagram is a  specialized graphic that illustrates the interrelationships between  entities in a database.  ER diagrams often use symbols to represent three different types of  information.  Boxes are commonly used to represent entities.  Diamonds  are normally used to represent relationships and ovals are used to  represent attributes.&lt;/div&gt;&lt;div&gt;&lt;b&gt;Also Known As: &lt;/b&gt;ER Diagram, E-R Diagram, entity-relationship model &lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Examples: &lt;/b&gt;&lt;/div&gt;Consider  the example of a database that contains information on the residents of  a city.  The ER digram shown in the image above contains two entities  -- people and cities.  There is a single &quot;Lives In&quot; relationship.  In  our example, due to space constraints, there is only one attribute  associated with each entity.  People have names and cities have  populations.  In a real-world example, each one of these would likely  have many different attributes.</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/8353260451657803828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/entity-relationship-diagram.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/8353260451657803828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/8353260451657803828'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/entity-relationship-diagram.html' title='Entity Relationship Diagram'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-4792472238809589064</id><published>2010-08-27T15:17:00.000-04:00</published><updated>2010-08-27T15:17:24.677-04:00</updated><title type='text'>Database Normalization</title><content type='html'>&lt;h3&gt;What is Normalization?&lt;/h3&gt;Normalization is the process of efficiently organizing data in a  database.  There are two goals of the normalization process:   eliminating redundant data (for example, storing the same data in more  than one table)  and ensuring data dependencies make sense (only storing related data in  a table).  Both of these are worthy goals as they reduce the amount of  space a database consumes and ensure that data is logically stored. &lt;h3&gt;The Normal Forms&lt;/h3&gt;The database community has developed a series of guidelines for ensuring  that databases are normalized.  These are referred to as normal forms  and are numbered from one (the lowest form of normalization, referred to  as first normal form or 1NF) through five (fifth normal form or 5NF).  In practical applications, you&#39;ll often see &lt;b&gt;1NF&lt;/b&gt;, &lt;b&gt;2NF&lt;/b&gt;, and &lt;b&gt;3NF&lt;/b&gt; along with the occasional &lt;b&gt;4NF&lt;/b&gt;.  Fifth normal form is very rarely seen and won&#39;t be discussed here.  &lt;br /&gt;
&lt;br /&gt;
Before we begin our discussion of the normal forms, it&#39;s important to  point out that they are guidelines and guidelines only.  Occasionally,  it becomes necessary to stray from them to meet practical business  requirements.  However, when variations take place, it&#39;s extremely  important to evaluate any possible ramifications they could have on your  system and account for possible inconsistencies.  That said, let&#39;s  explore the normal forms. &lt;h3&gt;First Normal Form (1NF)&lt;/h3&gt;First normal form (1NF) sets the very basic rules for an organized database:  &lt;ul&gt;&lt;li&gt; Eliminate duplicative columns from the same table.  &lt;/li&gt;
&lt;li&gt; Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).  &lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;Second Normal Form (2NF)&lt;/h3&gt;Second normal form (2NF) further addresses the concept of removing duplicative data: &lt;ul&gt;&lt;li&gt; Meet all the requirements of the first normal form. &lt;/li&gt;
&lt;li&gt; Remove subsets of data that apply to multiple rows of a table and place them in separate tables.  &lt;/li&gt;
&lt;li&gt; Create relationships between these new tables and their predecessors through the use of foreign keys.  &lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;Third Normal Form (3NF)&lt;/h3&gt;Third normal form (3NF) goes one large step further: &lt;ul&gt;&lt;li&gt; Meet all the requirements of the second normal form. &lt;/li&gt;
&lt;li&gt; Remove columns that are not dependent upon the primary key.  &lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;Fourth Normal Form (4NF)&lt;/h3&gt;Finally, fourth normal form (4NF) has one additional requirement: &lt;ul&gt;&lt;li&gt; Meet all the requirements of the third normal form. &lt;/li&gt;
&lt;li&gt; A relation is in 4NF if it has no multi-valued dependencies.  &lt;/li&gt;
&lt;/ul&gt;Remember, these normalization guidelines are cumulative.  For a database  to be in 2NF, it must first fulfill all the criteria of a 1NF database.</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/4792472238809589064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/database-normalization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/4792472238809589064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/4792472238809589064'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/database-normalization.html' title='Database Normalization'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-7998805978524283205</id><published>2010-08-26T14:47:00.000-04:00</published><updated>2010-08-26T14:47:56.125-04:00</updated><title type='text'>Top five Things Biggners Need to Know About Database</title><content type='html'>&lt;h2&gt;1. SQL Forms the Core of Relational Databases&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You  can&#39;t avoid it. The Structured Query Language forms the core of all  relational databases. It provides a uniform interface to Oracle, SQL  Server, Access and other relational databases and is a &quot;must learn&quot; for  all aspiring database users. In fact, I encourage you to take an  introductory SQL course before you even attempt to learn any specific  database software. The investment of time will help you build a proper  foundation and get started in the world of databases on the correct  foot. For a quick start, read &lt;a href=&quot;http://databases.about.com/od/sql/a/sqlbasics.htm&quot;&gt;SQL Basics&lt;/a&gt; or, for a more comprehensive introduction,&lt;a href=&quot;http://databases.about.com/c/ec/21.htm&quot;&gt;Refer About.com&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;2. Selecting Primary Keys is an Extremely Important Decision&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The  selection of a primary key is one of the most critical decisions you’ll  make in the design of a new database. The most important constraint is  that you must ensure that the selected key is unique. If it’s possible  that two records (past, present, or future) may share the same value for  an attribute, it’s a poor choice for a primary key. When evaluating  this constraint, you should think creatively. You&#39;ll also need to avoid  sensitive values, such as Social Security Numbers, as they raise privacy  concerns. For more information on selecting a strong primary key, read &lt;a href=&quot;http://databases.about.com/od/specificproducts/a/primarykey.htm&quot;&gt;Choosing a Primary Key&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;3. NULL Is Not Zero or the Empty String&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;NULL  is a very special value in the world of databases, but it&#39;s something  that beginners often get confused about. When you see a NULL value,  interpret it as &quot;unknown&quot;. If a quantity is NULL, that doesn&#39;t  necessarily mean that the quantity is zero. Similarly, if a text field  holds a NULL value, that doesn&#39;t mean that there isn&#39;t an appropriate  value, it&#39;s simply unknown. For example, consider a database containing  information about children who attend a particular school. If the  secretary entering the record does not know a student&#39;s age a NULL value  is used to indicate the &quot;unknown&quot; placeholder. The student certainly  has an age, it&#39;s just not present in the database.&lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;4. Converting Spreadsheets to Databases Saves Time&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;If  you already have tons of data stored in Excel (or other) spreadsheets,  you can save yourself mountains of time by converting those spreadsheets  into database tables. Read our tutorial on &lt;a href=&quot;http://databases.about.com/od/tutorials/ss/exceltoaccess.htm&quot;&gt;Converting Excel Spreadsheets to Access Databases&lt;/a&gt; to get started.&lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;5. All Database Platforms Are NOT Created Equal&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There  are many different databases out there and all offer a variety of  different features at different price points. Some are full-featured  enterprise databases designed to host huge data warehouses serving  multinational enterprises. Others are desktop databases better suited to  tracking inventory for a small store with one or two users. Your  business requirements will dictate the appropriate database platform for  your needs.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/7998805978524283205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/top-five-things-biggners-need-to-know.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/7998805978524283205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/7998805978524283205'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/top-five-things-biggners-need-to-know.html' title='Top five Things Biggners Need to Know About Database'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-2710742761596873036</id><published>2010-08-25T14:27:00.000-04:00</published><updated>2010-08-25T14:27:28.819-04:00</updated><title type='text'>Database Mirroring</title><content type='html'>&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span class=&quot;parameter&quot;&gt;Overview :&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;parameter&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;parameter&quot;&gt;Database mirroring&lt;/span&gt;  is a primarily software solution for increasing database availability.  Mirroring is implemented on a per-database basis and works only with  databases that use the full recovery model. The simple and bulk-logged  recovery models do not support database mirroring. Therefore, all bulk  operations are always fully logged. Database mirroring works with any  supported database compatibility level. &lt;br /&gt;
&lt;div class=&quot;introduction&quot;&gt;&lt;div class=&quot;alert&quot;&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr style=&quot;color: red;&quot;&gt;&lt;td&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note :&lt;/b&gt;&amp;nbsp;&amp;nbsp; We cannot mirror the &lt;u&gt;master&lt;/u&gt;,&lt;u&gt; msdb&lt;/u&gt;,&lt;u&gt; tempdb&lt;/u&gt;, or &lt;u&gt;model&lt;/u&gt; databases.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;Database  mirroring maintains two copies of a single database that must reside on  different server instances of SQL Server Database Engine. Typically,  these server instances reside on computers in different locations. One  server instance serves the database to clients (the &lt;span class=&quot;parameter&quot;&gt;principal server&lt;/span&gt;).&amp;nbsp;The other instance acts as a hot or warm standby server (the &lt;span class=&quot;parameter&quot;&gt;mirror server&lt;/span&gt;),  depending on the configuration and state of the mirroring session. When  a database mirroring session is synchronized, database mirroring  provides a hot standby server that supports rapid failover without a  loss of data from committed transactions. When the session is not  synchronized, the mirror server is typically available as a warm standby  server (with possible data loss). &lt;/div&gt;&lt;div class=&quot;LW_CollapsibleArea_Container&quot; xmlns=&quot;&quot;&gt;&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Benefits of Database Mirroring&lt;/span&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;b&gt;Database mirroring benefits: &lt;/b&gt;&lt;/div&gt;&lt;ul xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;li&gt;Increases data protection. &lt;br /&gt;
Database  mirroring provides complete or almost complete redundancy of the data,  depending on whether the operating mode is high-safety or  high-performance. For more information, see &quot;Operating Modes,&quot; later in  this topic.&lt;br /&gt;
A database mirroring partner running on SQL Server  2008 Enterprise&amp;nbsp;or later versions automatically tries to resolve certain  types of errors that prevent reading a data page. The partner that is  unable to read a page requests a fresh copy from the other partner. If  this request succeeds, the unreadable page is replaced by the copy,  which usually resolves the error. &lt;/li&gt;
&lt;li&gt;Increases availability of a database.&lt;br /&gt;
In  the event of a disaster, in high-safety mode with automatic failover,  failover quickly brings the standby copy of the database online (without  data loss). In the other operating modes, the database administrator  has the alternative of forcing service (with possible data loss) to the  standby copy of the database. For more information, see &quot;Role  Switching,&quot; later in this topic.&lt;/li&gt;
&lt;li&gt;Improves the availability of the production database during upgrades.&lt;br /&gt;
To  minimize downtime for a mirrored database, you can sequentially upgrade  the instances of SQL Server that are participating in a&amp;nbsp;database  mirroring session. This will incur the downtime of only a single  failover. This form of upgrade is known as a &lt;span class=&quot;parameter&quot;&gt;rolling upgrade&lt;/span&gt;. &lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;&lt;b&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;How Database Mirroring Works&lt;/span&gt;&lt;/b&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;The principal and mirror servers communicate and cooperate as &lt;span class=&quot;parameter&quot;&gt;partners&lt;/span&gt; in a &lt;span class=&quot;parameter&quot;&gt;database mirroring session&lt;/span&gt;. The two partners perform complementary roles in the session: the &lt;span class=&quot;parameter&quot;&gt;principal role&lt;/span&gt; and the &lt;span class=&quot;parameter&quot;&gt;mirror role&lt;/span&gt;.  At any given time, one partner performs the principal role, and the  other partner performs the mirror role. Each partner is described as &lt;span class=&quot;parameter&quot;&gt;owning&lt;/span&gt; its current role. The partner that owns the principal role is known as the &lt;span class=&quot;parameter&quot;&gt;principal server&lt;/span&gt;, and its copy of the database is the current principal database. The partner that owns the mirror role is known as the &lt;span class=&quot;parameter&quot;&gt;mirror server&lt;/span&gt;,  and its copy of the database is the current mirror database. When  database mirroring is deployed in a production environment, the  principal database is the &lt;span class=&quot;parameter&quot;&gt;production database&lt;/span&gt;. &lt;/div&gt;&lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;Database mirroring involves &lt;span class=&quot;parameter&quot;&gt;redoing&lt;/span&gt;  every insert, update, and delete operation that occurs on the principal  database onto the mirror database as quickly as possible. Redoing is  accomplished by sending a stream of active transaction log records to  the mirror server, which applies log records to the mirror database, in  sequence, as quickly as possible. Unlike replication, which works at the  logical level, database mirroring works at the level of the physical  log record. Beginning in SQL Server 2008, the principal server  compresses the stream of transaction log records before sending it to  the mirror server. This log compression occurs in all mirroring  sessions.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/2710742761596873036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/database-mirroring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/2710742761596873036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/2710742761596873036'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/database-mirroring.html' title='Database Mirroring'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-1977126204230532355</id><published>2010-08-23T16:23:00.000-04:00</published><updated>2010-08-23T16:23:04.944-04:00</updated><title type='text'>Replication</title><content type='html'>&lt;b&gt;SQL Replication&lt;/b&gt; term describes a group of technologies  allowing information distribution and mirroring between different  databases. SQL replication allows not only for copying data between  databases, but also copying any database objects as well. Essentially  replication performs synchronization between databases. By utilizing SQL  replication, you can distribute data to as many remote network  locations you need, and you can do that over different types of networks  including LAN, WAN, and Internet to name a few.&lt;br /&gt;
&lt;h2&gt;Why use SQL Replication?&lt;/h2&gt;There are many reasons why SQL replication exists. In many scenarios replication is done to ensure &lt;b&gt;redundancy&lt;/b&gt;.  For example if a business runs a mission-critical database, it may be  wise to have a replication of this database on a separate physical  database server, which can take over in case of failure in the primary  database (software corruption, hardware failure, etc.). Another valid  reason to use SQL replication is &lt;b&gt;load balancing&lt;/b&gt;. By using  replication you can share the access load between several database  server having identical databases. There are many other reason to use  SQL replication, however we won’t discuss them here.&lt;br /&gt;
&lt;h2&gt;Replication Publisher and Subscriber&lt;/h2&gt;To understand how SQL replication works, we’ll have to  define two replication terms – Publisher and Subscriber. In a SQL  replication the Publisher is the part that offers the data for  distribution. The Subscriber is the part that consumes (gets updates)  the data from the Publisher.&lt;br /&gt;
&lt;h2&gt;MS SQL Server Replication&lt;/h2&gt;MS SQL Server has 3 main replication models – Merge Replication, Transactional Replication and Snapshot Replication.&lt;br /&gt;
The &lt;b&gt;Merge replication&lt;/b&gt; is  used when both Publisher and Subscriber need to make changes to their  respective databases. In this case both databases might have been  changed between runs of the Merge SQL replication, and the replication  merges the changes in both locations. Of course when using merge  replication you should be aware that there might be conflicts, for  example duplicated primary keys. If there is a conflict, then the merge  replication follows predetermined conflict resolution plan to correct  the issue.&lt;br /&gt;
The &lt;b&gt;Transactional replication&lt;/b&gt;  is usually used with databases where data changes frequently and  there’s need for constant refreshing of the data. The replication  process watches the publisher’s database for any changes, if there are  changes, it distributes them over to the replication subscribers.&lt;br /&gt;
The &lt;b&gt;Snapshot replication&lt;/b&gt;  is relatively rarely used, and as its name implies it does a snapshot of  the publisher database at certain point of time and distributes it to  the subscribers. The Snapshot replication is time and resource consuming  compared to the other two SQL replication types and is used when you  need to fully overwrite the database at the subscriber or when you do an  initial database replication update, which will be refreshed using one  of the other 2 SQL replication types after the initial copy.</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/1977126204230532355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/replication.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/1977126204230532355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/1977126204230532355'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/replication.html' title='Replication'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-6766962096771417826</id><published>2010-08-20T16:38:00.002-04:00</published><updated>2010-08-20T16:38:41.035-04:00</updated><title type='text'>Using the BETWEEN condition</title><content type='html'>Use the BETWEEN condition to display rows based on&amp;nbsp;a range of values.&lt;br /&gt;
&lt;br /&gt;
SELECT last_name, salary&lt;br /&gt;
FROM employees&lt;br /&gt;
WHERE salary BETWEEN 2500 AND 3500;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The BETWEEN Condition&lt;/b&gt;&lt;br /&gt;
You can display rows based on a range of values using the BETWEEN range condition. The range that you&lt;br /&gt;
specify contains a lower limit and an upper limit.&lt;br /&gt;
The SELECT statement on the slide returns rows from the EMPLOYEES table for any employee whose&lt;br /&gt;
salary is between $2,500 and $3,500.&lt;br /&gt;
Values specified with the BETWEEN condition are inclusive. You must specify the lower limit first .</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/6766962096771417826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/using-between-condition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/6766962096771417826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/6766962096771417826'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/using-between-condition.html' title='Using the BETWEEN condition'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-4809250123818523829</id><published>2010-08-17T13:47:00.000-04:00</published><updated>2010-08-17T13:47:25.653-04:00</updated><title type='text'>Interview Question for SQL</title><content type='html'>&lt;h2 class=&quot;topic-title&quot;&gt;How do you implement one-to-one, one-to-many and many-to-many relationships while designingtables?&lt;/h2&gt;&lt;div class=&quot;author&quot;&gt;&lt;/div&gt;&lt;div class=&quot;content clearfix&quot;&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;One-to-One relationship can be  implemented as a single table and rarely as two tables with primary and  foreign key relationships. One-to-Many relationships are implemented by  splitting the data into two tables with primary key and foreign key  relationships. Many-to-Many relationships are implemented using a  junction table with the keys from both the tables forming the composite  primary key of the junction table.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;corners-top&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;h2 class=&quot;topic-title&quot;&gt;What&#39;s the difference between a primary key and a unique key?&lt;/h2&gt;&lt;div class=&quot;author&quot;&gt;&lt;/div&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;Both primary key and unique enforce uniqueness of the column on which they are defined. But by default&lt;br /&gt;
primary key creates a clustered index on the column, where are unique creates a nonclustered index by default.&lt;br /&gt;
Another major difference is that, primary key doesn&#39;t allow NULLs, but unique key allows one NULL only.&lt;/div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;h2 class=&quot;topic-title&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://www.sql-tutorial.co.cc/_.gif&quot; /&gt;Define candidate key, alternate key, composite key.&lt;/h2&gt;&lt;div class=&quot;author&quot;&gt;A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the&lt;/div&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;primary key of the table. If the table has more than one candidate key, one of them will become the primary&lt;br /&gt;
key, and the rest are called alternate keys.&lt;br /&gt;
A key formed by combining at least two or more columns is called composite key.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;h2 class=&quot;topic-title&quot;&gt;What is a transaction and what are ACID properties?&lt;/h2&gt;&lt;div class=&quot;author&quot;&gt;A transaction is a logical unit of work in which, all the steps must be performed or none. ACID stands for&lt;/div&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;Atomicity, Consistency, Isolation, Durability. These are the properties of a transaction. For more information and explanation of these properties, see SQL Server books online or any RDBMS fundamentals text book.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;corners-top&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;h2 class=&quot;topic-title&quot;&gt;Explain different isolation levels&lt;/h2&gt;&lt;div class=&quot;author&quot;&gt;&lt;span style=&quot;color: #000099;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL&lt;/div&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;Server isolation level is Read Committed. Here are the other isolation levels (in the ascending order of&lt;br /&gt;
isolation): Read Uncommitted, Read Committed, Repeatable Read, Serializable. See SQL Server books online for&lt;br /&gt;
an explanation of the isolation levels. Be sure to read about SET TRANSACTION ISOLATION LEVEL, which lets&lt;br /&gt;
you customize the isolation level at the connection level.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;h2 class=&quot;topic-title&quot;&gt; What&#39;s the maximum size of a row?&lt;/h2&gt;&lt;div class=&quot;content clearfix&quot;&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;8060 bytes. Don&#39;t be surprised with questions like &#39;what is the maximum number of columns per table&#39;. Check&lt;br /&gt;
out SQL Server books online for the page titled: &quot;Maximum Capacity Specifications&quot;.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;h2 class=&quot;topic-title&quot;&gt;What is lock escalation?&lt;/h2&gt;&lt;div class=&quot;author&quot;&gt;&lt;/div&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;Lock escalation is the process of converting a lot of low level locks (like row locks, page locks) into higher level&lt;br /&gt;
locks (like table locks). Every lock is a memory structure too many locks would mean, more memory being&lt;br /&gt;
occupied by locks. To prevent this from happening, SQL Server escalates the many fine-grain locks to fewer&lt;br /&gt;
coarse-grain locks. Lock escalation threshold was definable in SQL Server 6.5, but from SQL Server 7.0 onwards&lt;br /&gt;
it&#39;s dynamically managed by SQL Server.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;h2 class=&quot;topic-title&quot;&gt; What are constraints? Explain different types of constraints.&lt;/h2&gt;&lt;div class=&quot;content clearfix&quot;&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;Constraints enable the RDBMS enforce the integrity of the database automatically, without needing you to&lt;br /&gt;
create triggers, rule or defaults.&lt;br /&gt;
Types of constraints: NOT NULL, CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEY&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;&lt;span class=&quot;corners-top&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;h2 class=&quot;topic-title&quot;&gt;What is a join and explain different types of joins?&lt;!--
 google_ad_section_start --&gt;&lt;/h2&gt;&lt;div&gt;Joins are used in queries to explain how different tables are related. Joins also let you select data from a table&lt;br /&gt;
depending upon data from another table.&lt;br /&gt;
Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER&lt;br /&gt;
JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.&lt;br /&gt;
For more information see pages from books online titled: &quot;Join Fundamentals&quot; and &quot;Using Joins&quot;.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;corners-top&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;h2 class=&quot;topic-title&quot;&gt;What is a self join? Explain it with an example.&lt;/h2&gt;&lt;!--
 google_ad_section_start --&gt;&lt;div&gt;Self join is just like any other join, except that two instances of the same table will be joined in the query. Here&lt;br /&gt;
is an example:&lt;br /&gt;
Employees table which contains rows for normal employees as well as managers. So, to find out the managers&lt;br /&gt;
of all the employees, you need a self join.&lt;br /&gt;
CREATE TABLE emp&lt;br /&gt;
(&lt;br /&gt;
empid int,&lt;br /&gt;
mgrid int,&lt;br /&gt;
empname char(10)&lt;br /&gt;
)&lt;br /&gt;
INSERT emp SELECT 1,2,&#39;Vyas&#39;&lt;br /&gt;
INSERT emp SELECT 2,3,&#39;Mohan&#39;&lt;br /&gt;
INSERT emp SELECT 3,NULL,&#39;Shobha&#39;&lt;br /&gt;
INSERT emp SELECT 4,2,&#39;Shridhar&#39;&lt;br /&gt;
INSERT emp SELECT 5,2,&#39;Sourabh&#39;&lt;br /&gt;
SELECT t1.empname [Employee], t2.empname [Manager]&lt;br /&gt;
FROM emp t1, emp t2&lt;br /&gt;
WHERE t1.mgrid = t2.empid&lt;br /&gt;
Here&#39;s an advanced query using a LEFT OUTER JOIN that even returns the employees without managers (super&lt;br /&gt;
bosses)&lt;br /&gt;
SELECT t1.empname [Employee], COALESCE(t2.empname, &#39;No manager&#39;) [Manager]&lt;br /&gt;
FROM emp t1&lt;br /&gt;
LEFT OUTER JOIN&lt;br /&gt;
emp t2&lt;br /&gt;
ON&lt;br /&gt;
t1.mgrid = t2.empid&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/4809250123818523829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/interview-question-for-sql.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/4809250123818523829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/4809250123818523829'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/interview-question-for-sql.html' title='Interview Question for SQL'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-5517416105158219977</id><published>2010-08-14T12:53:00.000-04:00</published><updated>2010-08-16T22:26:38.587-04:00</updated><title type='text'>Basis Syntax of SQL</title><content type='html'>&lt;div style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SQL Select&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp; 1)&lt;span style=&quot;color: purple;&quot;&gt; &lt;b style=&quot;color: black;&quot;&gt;SELECT * from table_name&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This syntax is used for selecting all the data from the table or for selecting all table.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Example&lt;/b&gt; : Select * from Employee&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This will select all the data from the table Employee &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; 2) &lt;b&gt;SELECT column_name(s)&amp;nbsp; FROM table_name&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This syntax is used for selecting particular column from the table .&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Example&lt;/b&gt;&amp;nbsp; : Select Firstname,Lastname&amp;nbsp; from Employee&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This will select only Column name (Firstname and Lastname)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;div style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;SQL Distinct&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In a table, some of the columns may contain duplicate values. This is not a problem, however, sometimes you will want to list only the different (distinct) values in a table.The DISTINCT keyword can be used to return only distinct (different) values.&lt;br /&gt;
&lt;h3&gt;&amp;nbsp; 1) SELECT DISTINCT column_name(s) FROM table_name&lt;/h3&gt;&lt;h3 style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;font-size: small;&quot;&gt; Example&amp;nbsp; : Select&amp;nbsp; DISTINCT Lastname&amp;nbsp; from Employee&lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&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; This will select only distinct lastname from employee table &lt;/span&gt;&lt;/h3&gt;&lt;h3 style=&quot;font-weight: normal;&quot;&gt;&lt;/h3&gt;&lt;div style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;SQL Where&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/strong&gt;&lt;span style=&quot;color: black; font-size: small;&quot;&gt;Where is used&amp;nbsp; for condition in&amp;nbsp;writing query &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Column_name from table_name WHERE column_name&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;&lt;span style=&quot;color: black; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Example&amp;nbsp; : Select Firstname&amp;nbsp; from Employee where Lastname = Parker&lt;/span&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;&lt;strong&gt;SQL And &amp;amp; Or&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
SQL Order By&lt;br /&gt;
SQL Insert&lt;br /&gt;
SQL Update&lt;br /&gt;
SQL Delete</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/5517416105158219977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/basis-syntax-of-sql.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/5517416105158219977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/5517416105158219977'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/basis-syntax-of-sql.html' title='Basis Syntax of SQL'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2631787733157331720.post-1255487813276527206</id><published>2010-08-14T12:25:00.003-04:00</published><updated>2010-08-20T16:59:56.305-04:00</updated><title type='text'>SQL Intro</title><content type='html'>&lt;div class=&quot;intro&quot;&gt;SQL is a standard language for accessing and manipulating databases.&lt;/div&gt;&lt;hr /&gt;&lt;h2&gt;What is SQL?&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;SQL stands for Structured Query Language and lets you access and manipulate databases&lt;/li&gt;
&lt;li&gt;SQL is an ANSI (American National Standards Institute) standard&lt;/li&gt;
&lt;/ul&gt;&lt;hr /&gt;&lt;h2&gt;What Can SQL do?&lt;/h2&gt;&lt;ul&gt;&lt;li&gt; SQL can execute queries against a database&lt;/li&gt;
&lt;li&gt;SQL can retrieve data from a database&lt;/li&gt;
&lt;li&gt;SQL can insert records in a database&lt;/li&gt;
&lt;li&gt;SQL can update records in a database&lt;/li&gt;
&lt;li&gt;SQL can delete records from a database&lt;/li&gt;
&lt;li&gt;SQL can create new databases&lt;/li&gt;
&lt;li&gt;SQL can create new tables in a database&lt;/li&gt;
&lt;li&gt;SQL can create stored procedures in a database&lt;/li&gt;
&lt;li&gt;SQL can create views in a database&lt;/li&gt;
&lt;li&gt;SQL can set permissions on tables, procedures, and views&lt;/li&gt;
&lt;/ul&gt;&lt;hr /&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Using SQL in Your Web Site&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
To build a web site that shows some data from a database, you will need the following:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;An RDBMS database program (i.e. MS Access, SQL Server, MySQL)&lt;/li&gt;
&lt;li&gt;A server-side scripting language, like PHP or ASP&lt;/li&gt;
&lt;li&gt;SQL&lt;/li&gt;
&lt;li&gt;HTML / CSS&lt;/li&gt;
&lt;/ul&gt;&lt;hr /&gt;&lt;h2&gt;RDBMS&lt;/h2&gt;RDBMS stands for Relational Database Management System.&lt;br /&gt;
RDBMS is the basis for SQL, and for all modern database systems like  MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.&lt;br /&gt;
The data in RDBMS is stored in database objects called tables.&lt;br /&gt;
A table is a collections of related data entries and it consists of columns and rows.&lt;br /&gt;
&amp;nbsp;_____________________________________________________________&lt;br /&gt;
&lt;h2&gt;Semicolon after SQL Statements?&lt;/h2&gt;Some database systems require a semicolon at the end of each SQL statement.&lt;br /&gt;
Semicolon is the standard way to separate each SQL statement in  database systems that allow more than one SQL statement to be executed  in the same call to the server.&lt;br /&gt;
We are using MS Access and SQL Server 2000 and we do not have to put a  semicolon after each SQL statement, but some database programs force  you to use it.&lt;br /&gt;
&lt;hr /&gt;&lt;h2&gt;SQL DML and DDL&lt;/h2&gt;SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL).&lt;br /&gt;
The query and update commands form the DML part of SQL:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;SELECT&lt;/b&gt; - extracts data from a database&lt;/li&gt;
&lt;li&gt;&lt;b&gt;UPDATE&lt;/b&gt; - updates data in a database&lt;/li&gt;
&lt;li&gt;&lt;b&gt;DELETE&lt;/b&gt; - deletes data from a database&lt;/li&gt;
&lt;li&gt;&lt;b&gt;INSERT INTO&lt;/b&gt; - inserts new data into a database&lt;/li&gt;
&lt;/ul&gt;The DDL part of SQL permits database tables to be created or deleted.  It also define indexes (keys), specify links between tables, and impose  constraints between tables. The most important DDL statements in SQL are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;CREATE DATABASE&lt;/b&gt; - creates a new database&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ALTER DATABASE&lt;/b&gt; - modifies a database&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CREATE TABLE&lt;/b&gt; - creates a new table&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ALTER TABLE&lt;/b&gt; - modifies a table&lt;/li&gt;
&lt;li&gt;&lt;b&gt;DROP TABLE&lt;/b&gt; - deletes a table&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CREATE INDEX&lt;/b&gt; - creates an index (search key)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;DROP INDEX&lt;/b&gt; - deletes an index   &lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://sql-tutor1.blogspot.com/feeds/1255487813276527206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/sql-basic-functions.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/1255487813276527206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2631787733157331720/posts/default/1255487813276527206'/><link rel='alternate' type='text/html' href='http://sql-tutor1.blogspot.com/2010/08/sql-basic-functions.html' title='SQL Intro'/><author><name>Rinkesh</name><uri>http://www.blogger.com/profile/15134523125612275693</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>