Select * fromEmp--All data in EMP tableSelect * fromEmpwhereEnameinch('SMITH')--The data where ename is snith in the EMP tableSelectEname||'Is a' asIname fromEmpwhereEname= 'SMITH'--rename Ename Pius ' is a ' to InameSelectSal|| '_'||Ename asEmployees fromEmp--Sal plus ename to employeesSelect distinctSal fromEmp--Delete the same rowsSelect * fromEmpOrder bySaldesc--Show The all data in the SAL's data to up orderSelect * fromEmpwhereHireDate= 'March-December on -81'--show the data when the HireDate is ' 1981-12-03 'Select * fromEMPwhereSalbetween 1100 and the --Select the data of Sal 1100 toSelect * fromEMPwhereDeptnoinch(Ten, -)--where the deptno is ten orSelect * fromEmpwhereEname like '%_'--maybeSelect * fromEmpwhereComm is NULL-- NothingSelect * fromEmpwhere Lower(ename)= 'Smith' --Change the word to lowercaseSelectInitcap (ename) from(Select Lower(ename) asEname fromEmp-- Change the first letter to capitalSelectConcat'Hello',' World') fromDual--Attach the wordSelectSubstr'Goodgoodstudydaydayup',5,9) fromDual--cut nine letter start for five from the wordsSelectLength'Goodgoodstudydaydayup') fromDual--How many letter in the wordsSelectInStr'Goodgoodstudydaydayup','s') fromDual--The index of the letter's ' in the wordsSelectLpad ('Goodgoodstudydaydayup', -,'-') fromDual--Make the words have letters with the assignation words in the end,others fill in '-'SelectRpad ('Goodgoodstudydaydayup', -,'-') fromDual--Make the words have letters with the assignation words in the beginning,others fill in '-'SelectTrim'P' from 'Goodgoodstudydaydayup') fromDual--Delete the letter ' P ' from the starting or the end of the wordsSelect round(3.1415926535,4) fromDual--Retention 4 Decimal point with rounding of the numberSelectTrunc3.1415926535,4) fromDual--cut 4 Decimal point from the numberSelectMoDTen,3) fromDual--get the remainderSelectSysdate fromDual--get the currentdate of the systemSelectHireDate+5 fromEmp--The date plus 5,result is new dateSelectMonths_between ('January-August on -95','November-July on -94') fromDual--The defference of the dateSelectAdd_months ('January-July on -90',7) fromDual--The date add to 7 monthsSelect * fromEmpOrder bySaldesc--descending orderSelectNext_day (Sysdate,'Monday') fromDual--The date of the next MondaySelectLast_day (Sysdate) fromDual--The last day of the month of the assignation dateSelect Replace('Goodgoodstudydaydayup','D','y') fromDual--Replace ' d ' to ' Y 'SelectTo_char (Sysdate,'yyyy') fromDual--The year of currentdateSelectTo_char (Sysdate,'FMYYY-MM-DD') fromDual--format the system date to Year-month-daySelectTo_char (Sal,'$999,999,999') fromEmp--Format the currencySelectTo_number (' -')+To_number (' at') fromDual--Transform varchar to numberSelectTo_date ('19900725','YYYYMMDD') fromDual--transform from varchar to dateSelect * fromEmpwhereHireDate=Last_day (HireDate)-2--Reciprocal 3 daysSelect * fromEmpwhereHireDate<=Add_months (Sysdate,- -* A)--25years agoSelectInitcap (Concat ('Dear', ename)) fromEmp--the front of all ename add to ' dear ' and the change theSelect * fromEmpwhereLength (ename)= 5--whose the length of name is 5Select * fromEmpwhereEname not like('%r%')--whose name without the letter ' R 'SelectSUBSTR (ename,0,1) fromEmp--Select the first letter of name
Note: After each select is a separate statement, you need to add a semicolon after the end; ", otherwise you cannot run together
Oracle Database SELECT statement