Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.40 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create table elect_bill(RR_number varchar2(10),consumer_name
varchar2(25),date_billing date,units number(4));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'varchar2(10),consumer_name varchar2(25),date_billing date,units number(4))' at
line 1
mysql> mysql> create table elect_bill(RR_number varchar2(10),consumer_name
varchar2(25),date_billing date,units number(4));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql>
create table elect_bill(RR_number varchar2(10),consumer_name varchar2(25)' at line
1
mysql> create table elect_bill(RR_number varchar2(10),consumer_name
varchar2(25),date_billing date,units number(4));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'varchar2(10),consumer_name varchar2(25),date_billing date,units number(4))' at
line 1
mysql> create table elect_bill(RR_number varchar(10),consumer_name
varchar(25),date_billing date,units number(4));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'number(4))' at line 1
mysql> create table elect_bill(RR_number varchar(10),consumer_name
varchar(25),date_billing date,units int);
ERROR 1046 (3D000): No database selected
mysql> CREATE TABLE elect_bill (
-> RR_number VARCHAR(10),
-> consumer_name VARCHAR(25),
-> date_billing DATE,
-> units INT
-> );
ERROR 1046 (3D000): No database selected
mysql> CREATE DATABASE queries;
Query OK, 1 row affected (0.15 sec)
mysql> create table elect_bill(RR_number varchar(10),consumer_name
varchar(25),date_billing date,units int);
ERROR 1046 (3D000): No database selected
mysql> use queries;
Database changed
mysql> create table elect_bill(RR_number varchar(10),consumer_name
varchar(25),date_billing date,units int);
Query OK, 0 rows affected (0.88 sec)
mysql> desc elect_bill;
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| RR_number | varchar(10) | YES | | NULL | |
| consumer_name | varchar(25) | YES | | NULL | |
| date_billing | date | YES | | NULL | |
| units | int | YES | | NULL | |
+---------------+-------------+------+-----+---------+-------+
4 rows in set (0.07 sec)
mysql> insert into elect_bill values('A1001','manj','2/2/2014',34);
ERROR 1292 (22007): Incorrect date value: '2/2/2014' for column 'date_billing' at
row 1
mysql> sysdate
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'sysdate'
at line 1
mysql> insert into elect_bill values('A1001','manj','02-Nov-2024',34);
ERROR 1292 (22007): Incorrect date value: '02-Nov-2024' for column 'date_billing'
at row 1
mysql> INSERT INTO elect_bill VALUES ('A1001', 'manj', STR_TO_DATE('02-Nov-2024',
'%d-%b-%Y'), 34);
Query OK, 1 row affected (0.17 sec)
mysql> INSERT INTO elect_bill VALUES ('A1001', 'manj', '2024-11-02', 34);
Query OK, 1 row affected (0.13 sec)
mysql> alter tale elect_bill add(amount number(6,2),due_date date);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'tale
elect_bill add(amount number(6,2),due_date date)' at line 1
mysql> alter table elect_bill add(amount number(6,2),due_date date);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'number(6,2),due_date date)' at line 1
mysql> alter table elect_bill add(amount int(6,2),due_date date);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
',2),due_date date)' at line 1
mysql> ALTER TABLE elect_bill ADD (amount DECIMAL(6,2), due_date DATE);
Query OK, 0 rows affected (0.30 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> desc elect_bill;
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| RR_number | varchar(10) | YES | | NULL | |
| consumer_name | varchar(25) | YES | | NULL | |
| date_billing | date | YES | | NULL | |
| units | int | YES | | NULL | |
| amount | decimal(6,2) | YES | | NULL | |
| due_date | date | YES | | NULL | |
+---------------+--------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql> update elect_bill set amount=50;
Query OK, 2 rows affected (0.11 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> update elect_bill set amount=amount+100*4.50+(units-100)*5.50 where
units>100;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> update elect_bill set amount=amount+100*4.50+(units-100)*5.50 where
units<100;
Query OK, 2 rows affected (0.14 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> update elect_bill set due_date=date_billing+15;
Query OK, 2 rows affected (0.12 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> select * from elect_bill;
+-----------+---------------+--------------+-------+--------+------------+
| RR_number | consumer_name | date_billing | units | amount | due_date |
+-----------+---------------+--------------+-------+--------+------------+
| A1001 | manj | 2024-11-02 | 34 | 137.00 | 2024-11-17 |
| A1001 | manj | 2024-11-02 | 34 | 137.00 | 2024-11-17 |
+-----------+---------------+--------------+-------+--------+------------+
2 rows in set (0.00 sec)
mysql>