Oracle_DAY 01 operation statement SQL> enter the oracle operation environment to query data -- DB -- orders Table External table is the basic unit of data storage in the database. The basic unit of data storage in the table is a row of table name-marker table Header -- table data description View table structure by table Name -- desc table Name ------------------ ID employee ID LAST_NAME Name FIRST_NAME Name USERID # user description START_DATE employment date COMMENTS employee remarks MANAGER_ID leader employee id title Position DEPT_ID Department No. SALARY monthly SALARY COMMISSION_PCT: all columns selected, some rows selected projection: Some columns selected, all rows selected table join: data comes from multiple tables, and the connection between tables is queried:. from Statement 1. query the data of a field from the table select field from the table; select salary from s_emp; build the environment: SQL script <1> upload the script to the corresponding server; <2> run the script: @ path/Script Name 2. query multiple fields and columns first_name salary out select first_name, salary from s_emp; 3. list the values of all fields in the table as select id, first_name ...; * Indicates all field names. select * from s_emp; 4. the mathematical calculation of fields calculates the annual salary of each person in the select salary * 12 from s_emp; the priority can be changed with parentheses 12 * salary + 10012 * (salary + 100) 1/20. 5 select 1/2 from dual; 5. the field alias follows the field name and select first_name name, 12 * salary yearsal from s_emp; the alias has special characters: select first_name name, 12 * salary "year sal" from s_emp; 6. how does SQL express the string 'A' in SQL? '''hello world' = equals 7. string connection --- oracle unique | first_name last_name salaryselect first_name, last_name, salary from s_emp; select first_name | last_name, salary from s_emp; add an underline in first_name and last_name select first_name | last_name, salary from s_emp; add a single quotation mark in first_name and last_name select first_name | ''' | last_name, salary from s_emp; unable to translate single quotes --- escape single quotes select first_name | ''' | last_name, salary from s_emp; two single quotes express one single quotes concatenate one double quotes between fitst_name and last_name select first_name | ''' | last_name from s_emp; 8. processing of NULL values monthly salary * 12*(1 + Commission/100) select salary * 12, salary * (1 + commission_pct/100) * 12 from s_emp; the NULL value and any value are both NULLNULL value processing functions: nvl (parameter 1, parameter 2) parameter 1: value to be processed or field parameter 2: if parameter 1 is NULL, return the value of parameter 2. If parameter 1 is not NULL, return the value of parameter 1. Note: parameter 1 and parameter 2 must have the same type as select salary * 12, salary * nvl (1 + commission_pct/100) * 12, 0) from s_emp; // logic errorNULL should process select salary * 12, salary * (1 + nvl (commission_pct, 0)/100) * 12 yearsal from s_emp; put first_name and manager_id. If manager_id is NULL,-1 select first_name, nvl (manager_id,-1) from s_emp; 9 is displayed. distinct display show all the wages select salary from s_emp; different wages --- disinctselect distinct salary from s_emp; select distinct title from s_emp; multiple fields select distinct salary, id from s_emp; select first_name, last_name, title from s_emp; select dinstinct last_name, title from s_emp;