Second, SQL
Structur Query Language
Structured Query language is an object that operates in a relational database.
DDL (data definition Language), for table or delete operations, and for modifying table constraints
CREATE TABLE, ALTER TABLE, DROP table additions and deletions to the table structure.
DML (Data manipulation language), inserting records into a table, modifying records
Insert, UPDATE, delete, merge
Transaction, transaction control language, consisting of DML statements, commits; , rollback;
Select query statement
DCL Authorization Statement Grant
Third, Oracle
DBMS Database Management System
Oracle provided, as, application server
DBA database administrator
Iv. related Operations
1, sqlplus access to database commands (local access/remote access), and the database to establish a connection to the command, is the database operation of the environment
Sqlplus username/password
2, show user displays the user name of the current user
Change identity can directly connect username/password---this is sqlplus command
Can be used in Sqlplus! You can switch between the shell and the Sqlplus, and the!shell command can use the shell command in Sqlplus.
In fact, Sqlplus opened the subprocess to execute the shell command.
3. The tables in the Oracle database are divided into two categories: User tables (user-operated tables), system tables (database system-maintained tables, also called data dictionaries)
The DML operation of the system table is set off on the DDL operation of the user table!
V. Basic grammar
1. Select query statement
Select table_name from user_tables (Query system table)
The above query statement is the table name that queries all tables owned by this user.
The projection operation, viewing only the information for the selected field.
Select the action to view specific information in the field.
Join operation, multiple table query, through the table connection, search out the information in multiple tables
(1) Select table_name from user_tables (Query system table)
The above query statement is the table name that queries all tables owned by this user.
(2) The last SQL statement is cached in Sqlplus buffer, you can use "/" to execute this last SQL statement, or you can use the
The edit command to edit the last SQL statement.
The l command (list) (Sqlplus command) can display the last command in the buffer.
The Sqlplus command can be abbreviated
(3) DESC [table name]
This is a sqlplus command, notice that he is not an SQL statement, which is used to view the structure of the table. Descript's initials
[Field name] [Type of field], which is the table structure that is displayed after the desc command is used.
(4) Select [table field name 1],[table field Name 2], ... from table name;
SELECT * from table name; Tracing information for all fields in a table
(5) Keywords unequal split, SQL statements, and table names, field names are case-insensitive.
SQL statement to ";" End, to indicate the end of the SQL statement, if not add ";" The system does not execute this SQL statement and prompts.
The character display is left-aligned in Oracle, and the value is right-aligned.
(6) You can use mathematical expressions in a SELECT statement.
Select [Expression (must contain the name of this table field)],[],.... from table name;
The priority of the operation is multiplication and subtraction, and the same level is calculated from left to right, and the brackets change precedence.