1. SQL DML and DDLSQL can be divided into two parts: Data manipulation Language (DML) and data definition language (DDL).SQL (Structured Query language) is the syntax for executing queries. However, the SQL language also contains syntax for updating,
1. Date functionMssql:SELECT GETDATE ()Returns the current date and timeSELECT DATEPART (yyyy,orderdate) as OrderYear,DATEPART (mm,orderdate) as OrderMonth,DATEPART (dd,orderdate) as OrderdayFrom Orders1WHERE orderid=1Returns a separate part of the
SQL Basics
1.SQL not sensitive to case2.DML(Data Manipulation language) and DDL(data definition Language)A) DML
SELECT
UPDATE
DELETE
INSERT into
b) DDL
CREATE DATABASE
ALTER DATABASE
CREATE TABLE
I. Study 1, WWW-World Wide Web what is WWW?
www (World Wide web)
The World Wide Web is often referred to as
The web is a network of computers all over the world
All computers in the WEB can communicate with each other
All of
Select statements are used to select data from a table.The result is stored in a result table, called a result set.SQL SELECT SyntaxSELECT column name from table nameAnd:SELECT * FROM table nameNote : The SQL statement is not case sensitive. Select
SQL SELECT StatementTo get the contents of a column named "LastName" and "FirstName" (from a database table named "Persons"), use a SELECT statement like this:SELECT Lastname,firstname from Persons"Persons" table:
Id
LastName
SQL SELECT StatementSelect statements are used to select data from a table.The result is stored in a result table, called a result set.SQL SELECT SyntaxSELECT column name from table nameAnd:SELECT * FROM table nameNote: The SQL statement is not case
ArticleDirectory
Syntax:
"Orders" table:
Result:
Result:
SQL select distinct statement
Duplicate values may exist in the table. This is not a problem. However, sometimes you may want to list only different values.
The
SQL SELECT DISTINCT StatementIn the table, duplicate values may be included. That's not a problem, but sometimes you might want to just list different values (distinct).Keyword DISTINCT is used to return only different values.Grammar:SELECT DISTINCT
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.