How To Extract a Unit Value from a Date and Time?
Submitted by: AdministratorIf you want to extract a specific date or time unit value out of a date or a time, you can use the EXTRACT(unit FROM expression) function. The tutorial exercise below gives you some good examples:
ELECT EXTRACT(DAY FROM NOW()) FROM DUAL;
28
ELECT EXTRACT(HOUR FROM NOW()) FROM DUAL;
23
ELECT EXTRACT(SECOND FROM NOW()) FROM DUAL;
36
Submitted by: Administrator
ELECT EXTRACT(DAY FROM NOW()) FROM DUAL;
28
ELECT EXTRACT(HOUR FROM NOW()) FROM DUAL;
23
ELECT EXTRACT(SECOND FROM NOW()) FROM DUAL;
36
Submitted by: Administrator
Read Online MySQL Programming Job Interview Questions And Answers
Top MySQL Programming Questions
☺ | How To Use Regular Expression in Pattern Match Conditions? |
☺ | What Is TIMESTAMP in MySQL? |
☺ | How To Use CASE Expression? |
☺ | How To Write Date and Time Literals? |
☺ | How To Delete an Existing Column in a Table? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |