Access Interface Basic Operation

1. Display the table

2. Conditions "or"

SELECT graduate. Name, graduate student gender, graduate. Entrance scores
FROM Graduate
WHERE 
   (Graduate gender = "female" AND graduate. Entrance scores <100) OR 
   (Research students. Admission fraction = 101) OR 
   (Graduate entrance scores> 200);

3. like wildcards

character effect Remark
* Any + any number of characters  
? Any single character + Characters including Chinese characters
[] [] + A character within For example: 1 [ab] 2
- A character in the specified range + For example: 1 [az] 2
! A character not in range + For example: 1 [! Az], 1 [! Abc] 2
# Digital single +  

4. Calculation field

SELECT 
  Product.*, 
  [Purchase amount] - [sales] AS stock, 
  [Trade name] + [Type] stands for the AS, 
  Date () - [purchase date] the AS storage time
FROM commodities;

Table 5. Cross

6. Top

SELECT TOP 4 name, title, department number FROM tutor;

Between and 7. In use

SELECT name, gender, entrance scores, research
FROM Graduate
WHERE 
  (Graduate. Entrance scores Between 320 And 360) AND 
  (Study on the In direction ( "archeology", "accounting"));

8. Is Null

SELECT * FROM WHERE graduate student tutor No. Is Null;

9. Like

SELECT * FROM students WHERE name Like;

10. Sorting

SELECT * FROM graduate
WHERE entrance scores> 340
ORDER BY gender, entrance scores DESC;

11. Inner Join

SELECT department name, tutor's name, graduate students. Name
FROM (Department of Department ON INNER JOIN tutor ID = tutor system number.) ON INNER JOIN graduate tutor tutor ID = number tutor.;

It is equivalent to the following SQL:

SELECT department. Department name, tutor. Name, graduate students. Name
FROM Department, instructors, graduate
. The WHERE ID = tutor system of Department ID = AND tutor tutor tutor ID number...;

Note that using Cartesian product filtered AND

12. Aggregate Functions

SELECT Count ([students]! [Name]) AS Expression 1
FROM Graduate
WHERE gender = "male" AND entrance scores> = 340;

13. Broup by

SELECT instructors gender, the average Avg (mentor Age) AS Age of
. FROM GROUP BY mentor teacher sex;

==========

SELECT Round (Avg (entrance scores), 1) AS expression 1, Count (name) AS number in this group, teacher numbers
FROM Graduate
GROUP BY teacher numbers
HAVING Count (name)> 2;

14. nested query

select name, entrance scores
graduate from
where entrance scores> (select avg (entrance scores) from graduate)

15. Table query

Table query execution result of the SELECT trial will generate a new table, if the table does not exist, new construction, there is then prompted to overwrite.

SELECT name, entrance scores INTO temp table
FROM Graduate
WHERE entrance scores> (select avg (entrance scores) from graduate students);

16. Append Query

Append SELECT query is added to the result already exists in the table, "field corresponds."

INSERT INTO temp table (name, score, direction)
SELECT graduate. Name, graduate. Entrance scores, graduate research direction
FROM Graduate
. WHERE Graduate entrance scores> (select avg (entrance scores) from graduate);

17. Update Query

SET UPDATE graduate students. Start Score = [Start Score] + 1
. WHERE Graduate gender = "female";

18. Delete Query

DELETE graduate students. Sex
FROM Graduate
. WHERE Graduate gender = "female";

19. The non-operating interface

  • Distinct

转载于:https://www.cnblogs.com/rainman/p/3156564.html

Guess you like

Origin blog.csdn.net/weixin_34314962/article/details/93561333