SQL Intro
A common language for accessing and modifying databases is SQL.
What is SQL?
- SQL stands for Structured Query Language
- SQL lets you access and manipulate databases
- SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987
What Can SQL do?
- SQL can execute queries against a database
- SQL can retrieve data from a database
- SQL can insert records in a database
- SQL can update records in a database
- SQL can delete records from a database
- SQL can create new databases
- SQL can create new tables in a database
- SQL can create stored procedures in a database
- SQL can create views in a database
- SQL can set permissions on tables, procedures, and views
SQL is a Standard - BUT....
Despite being an ANSI/ISO standard, the SQL language comes in several forms.
But they all implement at least the major commands (such SELECT, UPDATE, DELETE, INSERT, and WHERE) in a comparable way in order to comply with the ANSI standard.
Note: In addition to the SQL standard, the majority of SQL database applications include their own proprietary extensions!
Using SQL in Your Web Site
You’ll need the following to create a website that displays data from a database:
- An RDBMS database program (i.e. MS Access, SQL Server, MySQL)
- To use a server-side scripting language, like PHP or ASP
- To use SQL to get the data you want
- To use HTML / CSS to style the page
RDBMS
Relational Database Management System is referred to as RDBMS.
All contemporary database systems, including MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access, are built on top of RDBMS.
Tables are database objects used by RDBMSs to hold data. A table is made up of rows and columns and contains a collection of connected data elements.
Examine the table marked “Customers”:
Example
SELECT * FROM Customers;
Each table is divided into fields, which are smaller units of data. CustomerID, CustomerName, ContactName, Address, City, PostalCode, and Country are the fields that make up the Customers table. A field in a table is a column intended to hold particular data about each record in the table.
A record, which is often referred to as a row, is every single entry in a table. For instance, the Customers table above contains 91 records. In a table, a record is a horizontal entity.
A column is a vertical element in a table that holds all of the data related to a certain field in the table.