Structured Query Language: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Tom Morris
m (Structured Query Language (SQL) moved to Structured Query Language: 'SQL' should be a redirect to Structured Query Language.)
imported>Tom Morris
(simple cleanup and subpages)
Line 1: Line 1:
SQL is a simple language designed for querying and managing Relational Database Management Systems (RDBMS).  RDBMSs organize data using tables, where each table has named column(s).  Each column has one datatype, and data is stored as rows intersecting with these columns and therefore satisfy the datatype of the corresponding column.  For example, a student table could have two columns, student_id and student_name.  If I want to insert data into this table, I would insert a row of two values, a student_id e.g. 001 and a student_name e.g. Claire.  It is this concept of tables that is the basis of SQL, which has become the defacto standard adopted by most database management systems vendors.  However, most vendors provide an extension to SQL to serve various functions ranging from the integration of procedural constructs to exception handling.
{{subpages}}
<br>
<br>
The syntax of a simple sql query: -
<br>
select <field names> from <table name> where <condition(s)>;
<br>
eg. select name, rollnum, totalmarks from studenttab where gpa>3;
<br>
The query above outputs the name, roll number and marks of all the students in the table studenttab who have a gpa greater than 3
<br>
This is a very basic example of a sql query. Queries can be nested in order to give more specific results as desired.


[[Category:CZ Live]]
'''Structured Query Language''' (SQL) is a simple language designed for querying and managing Relational Database Management Systems (RDBMS).  RDBMSs organize data using tables, where each table has named column(s).  Each column has one datatype, and data is stored as rows intersecting with these columns and therefore satisfy the datatype of the corresponding column.  For example, a student table could have two columns, student_id and student_name.  If I want to insert data into this table, I would insert a row of two values, a student_id e.g. 001 and a student_name e.g. Claire.  It is this concept of tables that is the basis of SQL, which has become the defacto standard adopted by most database management systems vendors.  However, most vendors provide an extension to SQL to serve various functions ranging from the integration of procedural constructs to exception handling.
[[Category:Stub Articles]]
 
[[Category:Computers]]
== Examples ==
The syntax of a simple SQL query:
<code>select <field names> from <table name> where <condition(s)>;</code>
eg. <code>select name, rollnum, totalmarks from studenttab where gpa>3;</code>
 
The query above outputs the name, roll number and marks of all the students in the table studenttab who have a gpa greater than 3. Queries can be nested in order to give more specific results as desired.

Revision as of 17:18, 16 July 2008

This article is a stub and thus not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.

Structured Query Language (SQL) is a simple language designed for querying and managing Relational Database Management Systems (RDBMS). RDBMSs organize data using tables, where each table has named column(s). Each column has one datatype, and data is stored as rows intersecting with these columns and therefore satisfy the datatype of the corresponding column. For example, a student table could have two columns, student_id and student_name. If I want to insert data into this table, I would insert a row of two values, a student_id e.g. 001 and a student_name e.g. Claire. It is this concept of tables that is the basis of SQL, which has become the defacto standard adopted by most database management systems vendors. However, most vendors provide an extension to SQL to serve various functions ranging from the integration of procedural constructs to exception handling.

Examples

The syntax of a simple SQL query:

select <field names> from

where <condition(s)>; eg. The query above outputs the name, roll number and marks of all the students in the table studenttab who have a gpa greater than 3. Queries can be nested in order to give more specific results as desired.

select name, rollnum, totalmarks from studenttab where gpa>3;