target object of the delete action is at the record level, you do not need to specify the column name information.
We can use
SQL> delete from students where student_id> 10;
3.2 delete
Besides
SQL> rollback;
Lower function:This function can change all uppercase letters to lowercase letters.SELECT lower ('abcde') FROM dual;Dual table is a virtual table.
Upper function: converts the input string to upper
Value List specifies the values of each column. The column names and values must correspond to each other.
1.2Batch insert
TableC_studentsThe data structure and content are as follows.
SQL> select * from c_students;
STUDENT_ID STUDENT_NAME
We can use the followingSQLThe statement inserts new data into the table. The new data comes from the table.StudentsMediumStudent_idTop 10 student information.
SQL> inse
Comparison of common functions of SQL Server and Oracle
--------- Mathematical functions1. Absolute ValueS: select abs (-1) valueO: select abs (-1) value from dual2. INTEGER (large)S: select ceiling (-1.001) valueO: select ceil (-1.001) value from dual3. Round (small)S: select floor (-1.001) valueO: select floor (-1.001) value from dual4. Round (truncation)S: sel
-dd '), ' year ') "New year" from DUAL;Select Trunc (15.71,1) "trunc" from dual;(5) General functions1.NVL () Filter empty functionSELECT sal*12 Salary, comm Bonus, SAL*12+NVL (comm,0) from EMP;2.NVL2 () Filter empty functionSELECT sal*12 Salary, comm Bonus, SAL*12+NVL2 (comm,comm,0) from EMP;3. Do not filter empty functionSELECT sal*12 Salary, comm Bonus, sal*12 from EMP;(6) Decode functionSELECT product_id, 1, ' Southlake ', 2, ' San Francisco ',
1. Query the current date and timeSelect from dual;2. Check the last day of this monthSelect from dual;3. How many months before and after querySelect add_months (sysdate, from dual;4. Check the specific date of the week of the following week (Sunday-Saturday: 1-7)Select next_day (sysdate,1 from dual;5, Time to turn timeSelect to_char (sysdate,'yyyy-mm-dd HH:MI:SS' from dual;6. Character Turn timeSelect to_date ('20160101','yyyy-mm-dd ' from dual;7. The date of the inquiry is specific to the d
Analysis function over and open window function
One: Analysis function over
Oracle provides analytic functions from 8.1.6, which are used to compute some sort of aggregation value based on a group, and the difference between it and the aggregate function is
Multiple rows are returned for each group, and aggregate functions
Tags: aggregation statistics HTTPS GROUP by has a WWW false log packet1, Row_number () over () sorting function:(1) Row_number () over () Grouping sorting function:When using the Row_number () over () function, the grouping in over () and the execution of the sort are later than the where group by order by.Partition by is used to group the result set, and if it is not specified then it takes the entire result set as a grouping, which differs from the aggregation function in that it can return mu
oracle| function Time: 2005-02-18
Oracle's SQL functions are divided into single-line functions and multiline functions. One-line functions are valid only for a single record, and multi-line f
modify information, and DML uses statements such as INSERT, select, Update, and delete to manipulate the data contained by database objects. (1). Create a table with an existing table Syntax: CREATE TABLE Select Column_names from eg 1), CREATE TABLE tb_dept as SELECT * from dept; 2), CREATE table tb_dept as select A.deptno, A.dname from dept A; 3), CREATE TABLE tb_dept as SELECT * FROM dept a where a.deptno=10; (2), select a row without duplicates, use the DISTINCT keyword eg, select distinc
; Parameter description: 1.substr (str, intercept start position, len) //Returns the intercepted Word, right (Str,len) returns the Len string starting from the rightmost 2.to_char (sysdate, ' YYYYMMDD ') //Return to current month day 3.NVL () // NVL (STR1,STR2) If the first parameter of Oracle is empty then the value of the second parameter is displayed, and if the value of the first parameter is not NULL, the first parameter is displayed. Summari
(SAL),Count (*), COUNT (Job), COUNT (Distinct (job)),Sum (SAL) from the EMP group by DEPTNO;2) Department 30 maximum wage, minimum wage, total number, number of jobs, number of jobs and sum of wagesSelect Deptno, Max (ename), Max (SAL),Min (ename), Min (Sal),AVG (SAL),Count (*), COUNT (Job), COUNT (Distinct (job)),Sum (SAL) from the EMP group by DEPTNO have deptno=30;3.stddev returns the standard deviation of a set of valuesSelect Deptno,stddev (SAL) from the EMP group by DEPTNO;Variance return
: INSERT into Tb_stu (ID, Birthday) VALUES (1, to_date (' 20111130 ', ' YYYYMMDD '));6, clear screen: clear screens;7. Two single quotes in Oracle represent a single quotation markeg, update tb_stu set pwd= ' 1 ' 2 ' where id=1;8. Oracle MatchEg, select * from Tb_stu where pwd like ' A% '--matches multipleSELECT * from Tb_stu where pwd like ' a_ '--matches a9, drop table tb_dept purge; --Permanently deleted
Label:Use SQL statements to export stored procedures and functions in Oracle: SETEchoif ;
SETHeadingoff ;
SETFeedbackoff ; SPOOL'C:/prc.sql' Replace
SELECT Case
whenLine= 1 Then
'CREATE OR REPLACE' || TEXT
whenLine=Max_line Then
TEXT ||CHR (Ten)|| '/'
ELSE
TEXT
END
fromUser_source A Left JOIN(
the database column name as key, and the record value is returned as value.
This time, however, you need to use Resultmap, which allows you to freely combine the return value of the form to handle more complex queries.
Or the first code:
Sql:
MyBatis Configuration:
Blog entity class
public class Bolg {
private Integer Authorid;
Private String AuthorName;
Private list
Post entity classes
public class
numberS:select rand () valueO:select Sys.dbms_random.value (0,1) value from dual;13. Take the symbolS:select sign ( -8) value-1O:select sign ( -8) value from Dual-1======= Mathematical Function =======14. PiS:select PI () value 3.1415926535897931O: I don't know15.sin,cos,tan parameters are measured in radiansExample: Select Sin (PI ()/2) value gets 1 (SQL Server)16.asin,acos,atan,atan2 return radians17. Radian Angle Interchange (sqlserver,
Tags: Enter use statement function style to establish a return return statement specificThe tables used in the following test cases are derived from the Scott scenario, before use, make sure that the user is unlocked1. Introductionfunction is used to return a specific data, when a function is established, the function header must contain a return clause, and the function body must contain the data returned by the return statement , we can use the CREATE function to establish the
--Create a functionCreate or Replace function Add_sal (ssal number) return numberIsBegin if (Ssal >) Then return ssal + 51; elsif (Ssal >) Then return ssal + 111; Else return ssal + 222; End If;EndSelect Sal, Add_sal (SAL) from EMP;--TriggerCREATE TABLE Deptlog ( UName varchar2 (20), Action Varchar2 (20), DTime Date);--Create a trigger--for each row can trigger multiple entries, and how many times your language affects how many records will be triggeredCreate
Single-record functions in SQL1. ASCIIReturns the decimal number corresponding to the specified character;SQL> select ascii ('A') A, ascii ('A') A, ascii ('0') zero, ascii ('') space from dual;A ZERO SPACE------------------------------------65 97 48 322. CHRReturns the corresponding characters;SQL> select chr (54740) zhao, chr (65) chr65 from dual;ZH C---Zhao3. C
.
Enter and execute the query:
SQL code
SELECTename, round (sysdate-hiredate) days
fromEmp
WHEREDeptno = 10;
SELECT ename, round (sysdate-hiredate) days
from emp
WHERE deptno = 10;
The result returned is:
Ename days
--------------- ---------------------
CLARK 7913
KING 7752
MILLER 7685
Note: This query uses the subtraction of dates to find the number of days between two dates. The number of days is rounded with the round function.
Conversio
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.