Learn SQL (Introduction)

Source: Internet
Author: User
Tags create index create database

What is SQL (pronounced "sequel")?

SQL full name is Structured Query Language (Structured Query language), which is the standard computer language for accessing and working with databases. A tool or interface that is used to access and manipulate a database. By using the SQL language, you can help include database creation, database or table deletion, fetching row data, and modifying some data, making it easier to access and manipulate data.

What can SQL do?

SQL can create new databases and their objects (tables, indexes, views, stored procedures, functions, triggers);

SQL can modify the structure of an existing database;

SQL can delete objects from the database;

SQL can ... A lot.

Using SQL, you need ...

1. An RDBMS database program (such as Ms Access,sql Server,mysql).

2. Use the server-side scripting language (such as PHP or ASP).

Rdbms

relational database Management system: relational databases management systems.

Data in an RDBMS is stored in a database object called a table .

Table

A table is a collection of related data items that consists of columns and rows.

code example:

SELECT *  from Customers;

Each table is decomposed into a smaller entity called a field . A field is a column in a table that maintains specific information about each record in a table and is a vertical entity in a table.

A record is each individual entry that exists in a table and is a horizontal entity in a table.

SQL syntax rules

1.SQL statements always start with a keyword;

The 2.SQL statement is always a semicolon ";" End

3.SQL is case insensitive.

Some of the most important SQL commands

select-extracting data from a database

update-updating data in a database

delete-deleting data from the database

Insert into-inserting data into the database

Create database-creating a new database

Alter database-Modify the database

Create table-creating a new table

Alter table-modify a database table

Drop table-Delete Table

Create index-Index

Drop index-Delete Index

Simple syntax for various statements

SELECT statement

SELECT  from table_name

SELECT statement and where statement

SELECT [*]  from [Table Name] WHERE [condition 1]

SELECT statement with where and/or clauses

SELECT [*]  from [Table Name] WHERE [condition 1] [and [OR][condition 2]...

SELECT Statement and ORDER BY

SELECT column_name ()  from table_name ORDER  by ASC or DESC

INSERT into statement

INSERT  into table_name (column ,column1, column2,column3 ...) VALUES 1 2 3...)

UPDATE statement

UPDATE table_name SET column = column 1 = 1 ,... WHERE some Column =some Value

DELETE statement

DELETE  from table_name WHERE some Column = some Value

Learn SQL (Introduction)

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.