DATE - format YYYY-MM-DD.
TIME - format HH:MM:SS
DATETIME - format: YYYY-MM-DD HH:MI:SS
Setting environment for using XAMPP for Windows.
Mounika@MOUNIKA-PC c:\xampp
# ram.cmd
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.4.18-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use vlrinst
Database changed
MariaDB [vlrinst]> show tables;
+-------------------+
| Tables_in_vlrinst |
+-------------------+
| emp |
| emp1 |
| people |
| vlr |
+-------------------+
4 rows in set (0.120 sec)
MariaDB [vlrinst]> drop table vlr;
Query OK, 0 rows affected (0.496 sec)
MariaDB [vlrinst]> create table vlr (bdate date,btime time,bdt datetime);
Query OK, 0 rows affected (0.389 sec)
MariaDB [vlrinst]> desc vlr;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| bdate | date | YES | | NULL | |
| btime | time | YES | | NULL | |
| bdt | datetime | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
3 rows in set (0.071 sec)
MariaDB [vlrinst]> insert into vlr values("1989-12-09",
-> "22:45:30","1989-12-09 22:45:30");
Query OK, 1 row affected (0.073 sec)
MariaDB [vlrinst]> select * from vlr;
+------------+----------+---------------------+
| bdate | btime | bdt |
+------------+----------+---------------------+
| 1989-12-09 | 22:45:30 | 1989-12-09 22:45:30 |
+------------+----------+---------------------+
1 row in set (0.041 sec)
MariaDB [vlrinst]> insert into vlr values("1989-12-09",
-> "22:99:30","1989-12-09 22:45:30");
Query OK, 1 row affected, 1 warning (0.115 sec)
MariaDB [vlrinst]> select * from vlr;
+------------+----------+---------------------+
| bdate | btime | bdt |
+------------+----------+---------------------+
| 1989-12-09 | 22:45:30 | 1989-12-09 22:45:30 |
| 1989-12-09 | 00:00:00 | 1989-12-09 22:45:30 |
+------------+----------+---------------------+
2 rows in set (0.000 sec)
MariaDB [vlrinst]> insert into vlr values("1989-13-09",
-> "22:99:30","1989-12-09 22:45:30");
Query OK, 1 row affected, 2 warnings (0.068 sec)
MariaDB [vlrinst]> select * from vlr;
+------------+----------+---------------------+
| bdate | btime | bdt |
+------------+----------+---------------------+
| 1989-12-09 | 22:45:30 | 1989-12-09 22:45:30 |
| 1989-12-09 | 00:00:00 | 1989-12-09 22:45:30 |
| 0000-00-00 | 00:00:00 | 1989-12-09 22:45:30 |
+------------+----------+---------------------+
3 rows in set (0.002 sec)
MariaDB [vlrinst]>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.