1.intersect to take the intersection of multiple query results;
2. Query the SQL statements recorded in the table of two basic time periods;
SELECT * from Shengjibiao t where t.createtime between to_date (' 2009-7-26 ', ' yyyy-mm-dd ') and to_date (' 2009-7-29 ', ' Yyyy-mm-dd ')
--You can also use >,<,>=,<=
Update Shengjilogin t set t.starttime=to_date (' 2009-01-02 01:02:01 ', ' yyyy-mm-dd hh24:mi:ss ') where t.username= ' 220819 '
3. Obtain two specified dates, the number of days between the time specified format
Select To_date (' 2009-04-01 13:02:01 ', ' yyyy-mm-dd hh24:mi:ss '). Add
-to_date (' 2009-03-08 13:02:01 ', ' yyyy-mm-dd hh24:mi:ss ')
From dual
4. It is useful to specify a period, the date type of the specified time format plus the number of months, and then convert to a string.
The queried type is the date type: Select Add_months (to_date (' 2009-07-27 02:31:11 ', ' yyyy-mm-dd hh24:mi:ss '), 2) from dual
The queried type is a string type: Select To_char (add_months (' 2009-07-27 02:31:11 ', ' yyyy-mm-dd hh24:mi:ss '), 2), ' Yyyy-mm-dd hh24 : Mi:ss ') as Tertime from dual
The use of substr function in 5.oracle database
Select substr (' CHENYP ', 2,4) from dual
Result: Heny
By the way, learn some:
Learning such a long database, suddenly realized that the meaning of the main foreign key database is completely confused, is the only identification of a record, for the connection query service, so that the understanding is not correct, or not entirely correct. Later, after his own meditation, read all kinds of information, and suddenly feel that they have a deep understanding of the external health of the database, and that this understanding is from the essential sense of understanding, and will not be confused. Although understanding may be superficial, the direction of understanding is right.
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.