Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
1 byte for two-digit Century
1 byte for two-digit Year
1 byte for two-digit Month
1 byte for two-digit Day
1 byte for two-digit Hour
1 byte for two-digit Minute
1 byte for two-digit Second
If the value is negative, it is B.C.; if the value is positive, it is A.D. The range of a DATE column (regardless of what anyone's documentation says) is:
4713-12-31 23:59:59.50000000000000001 B.C. to
9999-12-31 23:59:59.49999999999999... A.D.
In Oracle 9i, you can store sub-second granularity if you use Oracle's TIMESTAMP datatype. This datatype uses 11 bytes of storage: same format as DATE, plus 4 bytes for milliseconds.
So, in direct answer to your question, MrAsad, "...how do i create the table (MEMBER table with date and time joined), insert the values and select the the date and time fields, here is the best scenario, in my opinion:
SQL> create sequence member_seq;
Sequence created.
SQL> CREATE TABLE MEMBER
2 (MemberID number(7) primary key -- NOT NULL is automatic w/Primary Key
3 ,Member_name varchar(15) not null
4 ,Date_joined date
5 );
Table created.
SQL> insert into member values (member_seq.nextval,'MrAsad',sysdate);
1 row created.
SQL> col a heading "Date/Time Joined" format a22
SQL> select memberID, member_name, to_char(date_joined,'yyyy-mm-dd hh24:mi:ss')a
2 from member;
MEMBERID MEMBER_NAME Date/Time Joined
---------- --------------- ----------------------
1 MrAsad 2003-12-26 12:50:44
1 row selected.
SQL> create sequence RoomBooking_seq;
Sequence created.
SQL> create table RoomBookings
2 (Booking_ID number
3 ,Bldg_id varchar2(50)
4 ,Room_Num varchar2(20)
5 ,Reservation_Beg date
6 ,Reservation_End date
7 ,Reserver_Name varchar2(20)
8 ,Reserver_Phone varchar2(20)
9 );
Table created.
SQL> insert into RoomBookings values
2 (RoomBooking_seq.nextval
3 ,'Jesse Knight Bldg.'
4 ,'A-105'
5 ,to_date('2004-01-05 10:00:00','YYYY-MM-DD HH24:MI:SS')
6 ,to_date('2004-01-05 14:00:00','YYYY-MM-DD HH24:MI:SS')
7 ,'Dave Hunt'
8 ,'801-733-5333'
9 )
10 /
1 row created.
SQL> col a heading "Reserved|Room" format a25
SQL> col b heading "Reservation|Start" format a12
SQL> col c heading "Reservation|End" format a12
SQL> col d heading "Reservation|Contact|Info" format a25
SQL> select Room_num||', '||Bldg_id a
2 ,to_char(Reservation_Beg,'hh:mi a.m., DD Mon, YYYY') b
3 ,to_char(Reservation_End,'hh:mi a.m., DD Mon, YYYY') c
4 ,Reserver_Phone||': '||Reserver_Name d
5 from RoomBookings;
Reservation
Reserved Reservation Reservation Contact
Room Start End Info
------------------------- ------------ ------------ -----------------------
A-105, Jesse Knight Bldg. 10:00 a.m., 02:00 p.m., 801-733-5333: Dave Hunt
05 Jan, 2004 05 Jan, 2004
1 row selected.