SQL Server Getting Started Tutorial (1): Introduction to SQL and SQL syntax

Source: Internet
Author: User
Keywords Network programming MSSQL tutorials
Tags access be deleted computer computer language create data database systems delete

SQL is the standard computer language used to access and process databases.

What is SQL? SQL refers to Structured Query language SQL gives us the ability to access database SQL is an ANSI standard computer language

Editor's note: ANSI, United States national standardization Organization

What can

SQL do? SQL database-oriented query SQL can retrieve data from database SQL to insert new records in a database SQL updatable database data SQL can delete records from database SQL to create a new database SQL to create a new table SQL in a database create stored procedure SQL You can create view SQL in a database you can set permissions for tables, stored procedures, and views SQL is a standard-but ...

SQL is an ANSI standard computer language used to access and manipulate database systems. SQL statements are used to retrieve and update data in the database. SQL works in conjunction with database programs, such as Ms Access, DB2, Informix, MS SQL Server, Oracle, Sybase, and other database systems.

Unfortunately, there are many different versions of the SQL language, but in order to be compatible with the ANSI standard, they must support some key keywords in a similar way (such as SELECT, UPDATE, DELETE, INSERT, WHERE, and so on).

NOTE: Most SQL database programs have their own private extensions in addition to the SQL standard!

use SQL

in your Web site

To create a Web site that publishes data from a database, you need the following elements:

RDBMS database programs (such as MS Access, SQL Server, MySQL) server-side scripting languages (such as PHP or ASP) SQL CSS RDBMS

RDBMS refers to a relational database management system.

The RDBMS is the foundation of SQL, as well as the foundation of all modern database systems, such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.

The data in the RDBMS is stored in a database object called a table (tables).

A table is a collection of related data items, consisting of columns and rows.

database Table

A database typically contains one or more tables. Each table is identified by a name (such as "customer" or "order"). A table contains records (rows) with data.

The following example is a table named "Persons":

Id LastName FirstName address City 1 Adams John Oxford Street London 2 Bush George fifth Avenue New York 3 Carter Thomas Chang An street Beijing

The table above contains three records (one for each person) and five columns (Id, last name, address, and city).

SQL Statement

Most of the work you need to do on the database is done by the SQL statement.

The following statement selects the data from the LastName column from the table:

SELECT LastName from Persons

The result set looks like this:

LastName Adams Bush Carter

In this tutorial, we'll explain a variety of different SQL statements for you.

Important matters

Be sure to remember that SQL is insensitive to capitalization!

the semicolon after the SQL statement?

Some database systems require semicolons to be used at the end of each SQL command. We don't use semicolons in our tutorials.

Semicolons are the standard way to separate each SQL statement in a database system so that you can execute more than one statement in the same request to the server.

If you are using MS Access and SQL Server 2000, you do not have to use semicolons after each SQL statement, although some database software requires that semicolons be used.

SQL DML and DDL can divide SQL into two parts: Data manipulation Language (DML) and Data definition language (DDL).

SQL (Structured Query language) is the syntax used to execute queries. However, the SQL language also contains syntax for updating, inserting, and deleting records. This article originates from the Web teaching network.

The query and update Directives form the DML portion of SQL:

SELECT-fetching data from database tables update-updating data in a database table Delete-deletes data from a database table insert into-inserts data into a database table

The SQL Data definition Language (DDL) section gives us the ability to create or delete tables. We can also define indexes (keys), specify links between tables, and impose constraints between tables.

The most important DDL statement in SQL:

CREATE database-creating new databases alter DB-Modify database CREATE table-create new table ALTER TABLE-Change (change) database table DROP table-Delete table Create INDEX-Chuang Build index (search key) drop INDEX-delete index
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.