1. Access Data Type
Byte number [bytes]
Long number [long integer]
Short number [integer]
Single number [single precision]
Double Digit [Double Precision]
Currency
Char text
Text (n) text, where n indicates the field size
Binary
Counter automatic number
Memo remarks
Time date/time
In my personal opinion, the most important type is "Yes/No". Bit or yesno can be written. You can search for details. It seems that there are many related materials.
2. Create and delete Indexes
The method for creating an index through SQL in access is somewhat special.
Create Index name on table name ([field name]) // you can create duplicate indexes.
Create unique index name on table name ([field name]) // create a unique index
Delete:
Drop Index name on table name
3. Update statement
The update statement that involves multi-table queries and updates in access is also somewhat special.
Update tab1 A, tab2 B
Set a. Name = B. Name
Where a. ID = B. ID
SQL statements with the same function should be written in sqlserver
Update tab1
Set a. Name = B. Name
From tab1 A, tab2 B
Where a. ID = B. ID
That is to say, the update statement in access does not have the from clause, and all referenced tables are listed after the update keyword.
In addition, tab2 can be a query instead of a table, such
Update tab1 A, (select ID, name from tab2) B
Set a. ID = B. ID
The same function can also be written in this way.
Update tab1 a inner join tab2 B on A. ID = B. Id set a. Name = B. Name
4. External Connection
Access supports external connections, but does not include complete external connections. For example, left join and right join are supported, but full outer join or full join are not supported.
When multiple external table connections exist, each layer of connections must be enclosed by a pair of brackets, such
...... From (tab1 left join tab2 on tab1.id = tab2.id) left join tab3 on tab1.name = tab3.name)
In addition, all tables must be connected to the fields of the first table. For example, in the preceding sentence, if the second join condition is tab2.name = tab3.name, access is not supported. Note This.
5. In access, the date Delimiter is # Instead of quotation marks.
6. You can access different access files in an SQL statement. For example
Select a. *, B. * From tab1 A, tab2 B in 'db2. mdb 'Where a. ID = B. ID
The preceding SQL statement queries all the records associated with IDs in tab1 and db2.mdb (in the current folder) in the current database.
Ru
Insert into [Tab] select [userid], [username] from [; database = XX. mdb; Pwd = yourpassword]. [Table2]
Insert the userid and username field records in Table 2 of XX. mdb to the tab table of the current database. password access is supported.
7. access other ODBC data sources in access
The following example shows how to query data in sqlserver in access.
Select * From tab1 in [ODBC]
[ODBC; driver = SQL Server; uid = sa; Pwd =; server = 127.0.0.1; database = demo;]
The complete parameters of the external data source connection attribute are:
[ODBC; driver = driver; server = server; database = database; uid = user; Pwd = pass (Word);]
Where driver = driver can be in the Registry
Hkey_local_machinesoftwareodbcodbcinst.ini
8. Modify the Access Database Password
First, you must open the database exclusively.
The connection string can be written in this way.
[Provider = Microsoft. Jet. oledb.4.0; Data Source = XX. mdb; Jet oledb: Database Password = old password; mode = share deny read | share deny write]
After the connection is successful, you can write the SQL statement to change the password.
Alter Database Password [New Password] [old password]
If the password is null, enter null.
9. Set the complete constraints, please refer to the use of SQL statements to set or delete the primary key-constraint usage http://blog.csdn.net/icycode/archive/2010/03/27/5421803.aspx
10, Escape Character Processing, please refer to the "Access Escape Character" http://blog.csdn.net/icycode/archive/2010/01/22/5238099.aspx