--(Take the system time as an example, the actual situation can be replaced)1 Read system time –sysdateSelect sysdate from dual;2 Read time information (year, month, day, hour, minute, second)Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') as nowtime from dual; Date converted to stringSelect To_char (sysdate, ' yyyy ') as nowyear from dual; Get the year of the timeSelect To_char (sysdate, ' mm ') as now
data through graphical user interfaces, and a unique key is generated by the computer as the primary key of this record.
How can we find redundant data? Let's create a table named "Customer" and add redundant data to it. let's see Table 1. as you can see, we have not made any restrictions on this table to prevent redundant data, the following code creates a unique constraint to prevent redundant data generation.SQLListing 1. create a Customer tableWe intentionally added redundant data to this t
Tags: style blog color using AR sp div on COracle Two time subtraction default is the number of days Oracle two time subtraction default is the number of days* -The number of hours for the difference Oracle two time subtraction The default is the number of days* -* -number of minutes for difference Oracle two time subtraction The default is the number of days* -* -* -the number of seconds to vary--Months_between (date2,date1)Give the Date2-date1 month of SQL> SelectMonths_between ('1 September-D
Oracle Two time subtraction default is the number of daysOracle two time subtraction The default is the number of days *24 is the difference between the hoursOracle two time subtraction The default is the number of minutes *24*60 is the difference betweenOracle two time subtraction default is the number of days *24*60*60 is the difference in seconds--months_between (DATE2,DATE1)Give the month of date2-date1sql> Select months_between ('1 September-December -1999','1 September-March-1999 ') mon_
data file can span multiple physical disks. Here is the code to create the table and partition, as follows:CREATE TABLE Emp_range(EMPNO number NOT NULL primary key,DEPTNO number is not NULL,First_Name VARCHAR2 (+) NOT NULL,Last_Name VARCHAR2 (+) NOT NULL,Status char (1),Hire_date date NOT NULL)Partition by range (hire_date)(Partition Hire_part1 values less than (to_date (' 2017-04-01 ', ' yyyy-mm-dd ') tablespace emp_space01,Partition Hire_part2 valu
sin (20), sinh (20) from dual; sin (20) sinh (20 )------------------. 91294525 24258259832. SQRT returns the number N root SQL> select SQRT (64), SQRT (10) from dual; SQRT (64) SQRT (10) --------- 8 3.162277733.tan returns the tangent of a number. SQL> select Tan (20), Tan (10) from dual; Tan (20) Tan (10) --------- ------- 2.2371609. 6483608334. tanh returns the hyperbolic tangent of number n SQL> select Tanh (20), Tan (20) from dual; Tanh (20) Tan (20) --------- 1 2.2371609 35. trunc intercep
meet the time range limit
Query the Oracle Date Format----------------------------------
Select * From nls_database_parameters;
The following table shows the date format in the table nls_date_format.Parameter Value----------------------------------------------------------------------Nls_language AmericanNls_territory AmericaNls_currency $Nls_iso_currency AmericaNls_numeric_characters .,Nls_characterset zhs16gbkNls_calendar GregorianNls_date_format DD-MON-RRNls_date_language AmericanNls_s
The first day of a month
SELECT to_date(to_char(SYSDATE,'yyyy-mm')||'-01','yyyy-mm-dd')FROM dual
Sysdate is the current system time of the database server.To_char is a function that converts a date type into a date type.To_date is a function that converts the string type to the date type. Generally, the format is yyyy-mm-dd hh24: mi: ss. If no time is specifi
Reprinted from: http://blog.csdn.net/redarmy_chen/article/details/7351410
Oracle Two-time subtraction default is days
Oracle Two-time subtraction default is the number of days *24 to the difference in hours
Oracle Two-time subtraction the default is the number of days *24*60 to the difference in minutes
Oracle Two-time subtraction the default is the number of days *24*60*60 to the difference in seconds
--months_between (DATE2,DATE1)Give out the month of date2-date1Sql> Select Months_between ('
a leading zero.
The abbreviated name of the MMM month, defined in AbbreviatedMonthNames.
The full name of the MMMM month, defined in MonthNames.
Y does not contain the year of the era. If the year that does not contain the era is less than 10, the year is displayed with no leading zeros.
YY does not contain years of the era. If the year that does not contain the era is less than 10, the year with leading zeros is displayed.
YYYY includes the four-dig
first way (use the to_char () function to format the date type as a required String type)Select substr (To_char (DQSJ, ' yyyy-mm-dd '), 1,4) as year from Test_table Group by substr (To_char (DQSJ, ' yyyy-mm-dd '), 1,4) Order BY substr (To_char (DQSJ, ' yyyy-mm-dd '), 1,4);Select To_char (DQSJ, ' yyyy ') as year from T
Oracle time operations and to_char and to_date usage summary Oracle time processing sometimes to_char and to_date are two key functions. Here we will summarize: 1. Obtain the current system time select sysdate from dual; usage of to_char select to_char (sysdate, 'yyyy. mm. dd') from dualselect to_char (sysdate, 'yyyy-mm-dd') from dualselect to_char (sysdate, 'yyyy
To_date formatDay:Dd number 12Dy abbreviated FriDay spelled out FridayDdspth spelled out, ordinal twelfthMonth:MM number 03Mon abbreviated MARMonth spelled out MarchYear:YY two digits 98Yyyy four digits 1998
The time range in the 24-hour format is: 0:00:00-23:59:59 ....The time range in the 12-hour format is: 1:00:00-12:59:59 ....
[ZT] Date and ?? Letter ???1.Date and character conversion function usage (to_date, to_char)
2.Select to_char (to_date (222, 'J'), 'jsp ') from dual
Display two hundre
Date Processing Full Edition To_date formatDay:Dd number 12Dy abbreviated FriDay spelled out FridayDdspth spelled out, ordinal twelfthMonth:MM number 03Mon abbreviated MARMonth spelled out MarchYear:YY two digits 98Yyyy four digits 1998The time range in the 24-hour format is: 0:00:00-23:59:59 ....The time range in the 12-hour format is: 1:00:00-12:59:59 ....1.Date and character conversion function usage (to_date, to_char)2.Select to_char (to_date (222, 'J'), 'jsp ') from dualDisplay two hundre
--Create student tablesCREATE TABLE xs_543(XH char (6) NOT NULL,XM varchar2 () NOT NULL,Zym VARCHAR2 (10),XB char (4) Default ' male ',CSSJ date,ZXF Number (2),BZ varchar2 (100),Constraint Pk_xh primary KEY (XH));--Create a curriculumCREATE TABLE kc_543(KCH char (3) NOT NULL,KCM varchar2 () NOT NULL,KKXQ Number (1) Default 1,XS Number (2),XF number (1),Constraint Pk_kch primary KEY (KCH),Constraint ck_kkxq Check (KKXQ between 1 and 8));--Create a score tableCREATE TABLE xs_kc_543(XH Char (6) NOT
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.