Structured query statement format

Source: Internet
Author: User
Tags create domain

Structured query statement format
Database (DataBase): The data warehouse where data is stored. A table, especially Excel, stores data in the form of tables. You can create multiple tables.

Common databases: sqlite, access, MySQL, SqlServer, Oracle;


Why use the database;
1. file read/write, archive read data needs to read all the data at a time, occupying the memory
2. The efficiency of searching data in the database is very high. It is reflected in data search and data modification (addition, deletion, modification, and query)

Structured Query Language)Structured query statement, used for database operation statements (add, delete, modify, and query)
SQL statements are case insensitive.
Double quotation marks or single quotation marks are required for the string.
*: Represents all
Where: Yes (it can be left empty)
Primary Key: it is the unique identifier of a data record. A table can only have one primary key and the primary key cannot be repeated. Generally, the primary key name is set to "id" and does not need to be assigned a value, the following table is automatically added/created: Create tableTable Name (whether the field Name field data type is a primary key, field Name field data type, field Name field data type ,......)
Query: SelectField (or *) FromTable Name WhereField = Value
Add: InsertTable Name (Field 1, Field 2 ,...) Values(Value 1, value 2 ,...)
Change: UpdateTable Name SetField = Value WhereField = Value
Delete: Delete fromTable Name WhereField = Value
What is the SQL query statement format?

Common SQL statements of VF

SQL is a structured query language. query is an important part of SQL, but not all. SQL also includes data definition, data manipulation, and data control functions. today, SQL has become the standard data language for relational databases, so the current relational database management system supports SQL. FOXPRO began to support SQL from the 2.5 for dos layout, and now visual foxpro is of course more comprehensive in this regard. The following are SQL statements that are frequently used by VF.
-- Sentence skill

-- Data Operations
SELECT -- retrieve data rows and columns from database tables
INSERT -- add new data rows to the database table
DELETE -- DELETE data rows from a database table
UPDATE -- UPDATE data in the database table
-- Data Definition
Create table -- CREATE a database TABLE
Drop table -- delete a TABLE from a database
Alter table -- modify the database TABLE structure
Create view -- CREATE a VIEW
Drop view -- delete a VIEW from a database
Create index -- CREATE an INDEX for the database table
Drop index -- delete an INDEX from a database
Create procedure -- CREATE a stored PROCEDURE
Drop procedure -- delete a stored PROCEDURE from a database
Create trigger -- CREATE a TRIGGER
Drop trigger -- delete a TRIGGER from a database
Create schema -- Add a new SCHEMA to the database
Drop schema -- delete a SCHEMA from the database
Create domain -- CREATE a Data Value DOMAIN
Alter domain -- change DOMAIN definition
Drop domain -- delete a DOMAIN from the database
-- Data Control
GRANT -- GRANT the user access permission
DENY-DENY User Access
REVOKE -- REVOKE User Access Permissions
-- Transaction control
COMMIT -- end the current transaction
ROLLBACK -- abort the current transaction
Set transaction -- define the data access features of the current TRANSACTION
-- Programmatic SQL
DECLARE -- set the cursor for the query
Explain -- describe the data access plan for query
OPEN -- OPEN a cursor for retrieving query results
FETCH -- retrieve a row of query results
CLOSE -- CLOSE the cursor
PREPARE -- prepare SQL statements for dynamic execution
EXECUTE -- dynamically execute SQL statements
DESCRIBE -- DESCRIBE the prepared Query
--- Local variables
Declare @ id char (10)
-- Set @id = 10010001
Select @ id = 10010001.

--- Global variables
--- It must start @

-- IF ELSE
Declare @ x int @ y int @ z int
Select @ x = 1 @ y = 2 @ z = 3
If @ x> @ y
Print x> y -- print string x> y
Else if @ y> @ z
Print y> z
Else print z> y

-- CASE
Use pangu
Update employee
Set e_wage =
Case
When job_level = '1' then e_wage * 1.08
When job_level = '2' then e_wage * 1.07
When job_level = '3' then e_wage * 1.06
Else e_wage * 1.05
End

-- WHILE CONTINUE BREAK
Declare @ x int @ y int @ c int
Select @ x = 1 @ y... remaining full text>

What is the abbreviation of the structured query statement in access?

If you want to create a teaching material table, the ISBN number, teaching material name, version number, author, and publishing house are of CHAR type, and the width is 13, 30, 1, 6, and 15, respectively, the price is double-precision, and the publishing year is date.
 

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.