(5) SELECT (5-2) DISTINCT (5-3) Top () (5-1)
(1) from (1-j) join on
(2) WHERE
(3) GROUP by
(4) Having
(6) Order by ;
Each step generates a virtual table that will act as the next input. These virtual tables are not available to callers,
Check this diary record
SELECT * FROM Messages WHERE convert (Nvarchar, createdate, MR) = CONVERT (Nvarchar, GETDATE (),) Order by CreateD Ate DESC
SELECT * from table WHERE DateDiff (day, column name , GETDATE ()) =0
Check this year
SELECT
(5) SELECT (5-2) DISTINCT (5-3) TOP () (5-1)
(1) FROM (1-J) JOIN on
(2) WHERE
(3) group by
(4) HAVING
(6) order by ;
A virtual table is generated for each step, which is used as the input for the next step. These virtual tables are not
Query statements are widely used, but few people know the sequence of statement execution and the role of each stage. Here is a brief introduction.
Query statements are widely used, but few people know the sequence of statement execution and the
1. The simplest single-condition query, where specifies the query conditions.
Select messagetype, messagename from t_sr_message where messagename = 'manage'
The following lists several query conditions, not all:
2. query groupsSelect superno,
****************Tablespace****************
# View the tablespace creation processSets long 9999Select dbms_metadata.get_ddl ('tablespace', 'example ') from dual;
# Query the usage of a single tablespaceSelect sysdate, A. tablespace_name "tablespace
1. Find employees with a Commission higher than 60% of their salaries.
Select * From e where comm> Sal * 0.6;
2. Find out the details of all clerks in department 10, all managers and department 20.
Select * from EMP
Where deptno = 10 and job =
1. Obtain the first row of data in the table
select top 1 * from Dept
2. display a specific row in the first row
select DeptNO,DeptName,Phone,Manager,Deputy,Remark from dept where parentID='3' order by case when deptNO='3' then 0 else 1 end
3. SQL
SELECT prod_name, prod_priceFROM ProductsWHERE vend_id = 'DLL01' OR vend_id = 'BRS01'AND prod_price >= 10;
prod_name prod_price------------------- ----------Fish bean bag toy 3.4900Bird bean bag toy 3.4900Rabbit bean bag
When I write an SQL query statement in a program recentlyI found a strange problem:Select * Form tablename where name = '"+ textbox1.text + "'"
Sometimes, there is no problem in running.However, sometimes problems occur.For example, the content of
Steps for Oracle to execute SQL query statementsThe SQL query statement executed by Oracle is different from that of other statements. If the query statement is successfully executed, the query result is returned. Other types of SQL statements only
Shows the structure of a table (ColumnTable ).
Functions to be implemented: Obtain the current node ID and parent node ID through the value of Number 67
Implement SQL statements recursively:Copy codeThe Code is as follows:With znieyu(Select c.
For SQL queries with the highest score, lowest score, and average score, take the Student score as an example. * structure Student table Student (S #, Sname, Sage, Ssex) -- S # Student ID, sname Student name, Sage year of birth, Ssex Student gender-2
A Query method
thinkphp provides three basic query methods: String conditional query, indexed array condition query, and object bar
Query. In most cases, it is recommended to use indexed arrays and object methods as query criteria because it is more
Select COUNT (VIRTUALACC) into V_count from t_atmmonitor WHERE VIRTUALACC = v_number;For the stored procedure, the value of the count (VIRTUALACC) statistic is assigned to the variable v_count, and the V_count variable is called in subsequent stored
The following code from the network, untested, the operation of the database is risky, please backup in advance!Add a custom field to all articles and pagesThis code can add a custom field to all articles and pages in the WordPress database. All you
Split Program code
Names=split (Attribs, "^^")
I=0
For each name in names
Response.Write Names (i) & ""
I=i+1
Next%>
Program Split Result:
Store Name
Snack Bar Name
Name of the newspaper stop
Generate SQL statement based on Split result
Names=split (
Split Program code
Copy Code code as follows:
Names=split (Attribs, "^^")
I=0
For each name in names
Response.Write Names (i) & ""
I=i+1
Next
%>
Program Split Result:Store NameSnack Bar NameName of the newspaper
Optimization | statement
(1) INSERT [into] b SELECT ID, field1, field2 from A WHERE does EXISTS (select id from b where id=[a.] Id
(2) INSERT [into] B SELECT * from A WHERE-id not in (SELECT ID from B)
--------------------------------------------
First, simple query
A simple Transact-SQL query includes only a picklist, a FROM clause, and a WHERE clause. They describe the query column, the table or view of the query, and the search criteria, and so on.
For example, the following statement
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.