EVOLUTION-NINJA
Edit File: 1751815627Sql_1&2.txt
Microsoft Windows [Version 10.0.22631.4169] (c) Microsoft Corporation. All rights reserved. C:\Users\User>cd../.. C:\>D: D:\>cd xampp D:\xampp>cd mysql D:\xampp\mysql>cd bin D:\xampp\mysql\bin>mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 10.4.32-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 hima Database changed MariaDB [hima]> create table Salesman; ERROR 1050 (42S01): Table 'salesman' already exists MariaDB [hima]> show tables; +----------------+ | Tables_in_hima | +----------------+ | salesman | | students | +----------------+ 2 rows in set (0.001 sec) MariaDB [hima]> desc salesman; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+ | salesman_id | int(11) | YES | | NULL | | | name | varchar(255) | YES | | NULL | | | city | varchar(255) | YES | | NULL | | | comission | int(255) | YES | | NULL | | +-------------+--------------+------+-----+---------+-------+ 4 rows in set (0.005 sec) MariaDB [hima]> select * from salesman; Empty set (0.001 sec) MariaDB [hima]> insert into students(salesman_id,name,city,comission) -> values(1,'Ram','Paris',46600), -> (2,'Ramya','Britan',20034) -> (3,'Jhon', 'Paris',56778) -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(3,'Jhon', 'Paris',56778)' at line 4 MariaDB [hima]> select * from salesman; Empty set (0.001 sec) MariaDB [hima]> insert into salesman(salesman_id,name,city,comission) -> values(1,'Ram','Paris',46600), -> (2,'Ramya','Britan',20034) -> (3,'Jhon', 'Paris',56778); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(3,'Jhon', 'Paris',56778)' at line 4 MariaDB [hima]> select * from salesman; Empty set (0.001 sec) MariaDB [hima]> insert into students(salesman_id,name,city,comission) -> values(1,'Ram','Paris',46600), -> (2,'Ramya','Britan',20034); ERROR 1054 (42S22): Unknown column 'salesman_id' in 'field list' MariaDB [hima]> insert into salesman(salesman_id,name,city,comission) -> values(1,'Ram','Paris',46600), -> (2,'Ramya','Britan',20034); Query OK, 2 rows affected (0.005 sec) Records: 2 Duplicates: 0 Warnings: 0 MariaDB [hima]> select * from salesman; +-------------+-------+--------+-----------+ | salesman_id | name | city | comission | +-------------+-------+--------+-----------+ | 1 | Ram | Paris | 46600 | | 2 | Ramya | Britan | 20034 | +-------------+-------+--------+-----------+ 2 rows in set (0.001 sec) MariaDB [hima]> insert into salesman(salesman_id,name,city,comission) -> values(3,'Ram','Paris',46600), -> (4,'Ramya','Britan',20034), -> (5,'Ramya','Britan',20034), -> (6,'Ramya','Britan',20034), -> (7,'Ramya','Britan',20034); Query OK, 5 rows affected (0.004 sec) Records: 5 Duplicates: 0 Warnings: 0 MariaDB [hima]> select * from salesman; +-------------+-------+--------+-----------+ | salesman_id | name | city | comission | +-------------+-------+--------+-----------+ | 1 | Ram | Paris | 46600 | | 2 | Ramya | Britan | 20034 | | 3 | Ram | Paris | 46600 | | 4 | Ramya | Britan | 20034 | | 5 | Ramya | Britan | 20034 | | 6 | Ramya | Britan | 20034 | | 7 | Ramya | Britan | 20034 | +-------------+-------+--------+-----------+ 7 rows in set (0.001 sec) MariaDB [hima]> select distinct city from salesman; +--------+ | city | +--------+ | Paris | | Britan | +--------+ 2 rows in set (0.001 sec) MariaDB [hima]> alter salesman add country varchar(255); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'salesman add country varchar(255)' at line 1 MariaDB [hima]> select name,city from salesman; +-------+--------+ | name | city | +-------+--------+ | Ram | Paris | | Ramya | Britan | | Ram | Paris | | Ramya | Britan | | Ramya | Britan | | Ramya | Britan | | Ramya | Britan | +-------+--------+ 7 rows in set (0.002 sec) MariaDB [hima]> alter table salesman add country varchar(255); Query OK, 0 rows affected (0.008 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [hima]> desc salesman; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+ | salesman_id | int(11) | YES | | NULL | | | name | varchar(255) | YES | | NULL | | | city | varchar(255) | YES | | NULL | | | comission | int(255) | YES | | NULL | | | country | varchar(255) | YES | | NULL | | +-------------+--------------+------+-----+---------+-------+ 5 rows in set (0.016 sec) MariaDB [hima]> alter table salesman add date Date; Query OK, 0 rows affected (0.014 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [hima]> insert into salesman(salesman_id,name,city,comission,country,date) -> values(8,'rahul','mysore',60000,'india',04-04-2024); Query OK, 1 row affected, 1 warning (0.003 sec) MariaDB [hima]> select * from salesman; +-------------+-------+--------+-----------+---------+------------+ | salesman_id | name | city | comission | country | date | +-------------+-------+--------+-----------+---------+------------+ | 1 | Ram | Paris | 46600 | NULL | NULL | | 2 | Ramya | Britan | 20034 | NULL | NULL | | 3 | Ram | Paris | 46600 | NULL | NULL | | 4 | Ramya | Britan | 20034 | NULL | NULL | | 5 | Ramya | Britan | 20034 | NULL | NULL | | 6 | Ramya | Britan | 20034 | NULL | NULL | | 7 | Ramya | Britan | 20034 | NULL | NULL | | 8 | rahul | mysore | 60000 | india | 0000-00-00 | +-------------+-------+--------+-----------+---------+------------+ 8 rows in set (0.001 sec) MariaDB [hima]> values(9,'rahul','mysore',60000,'india','04-04-2024'); +---+-------+--------+-------+-------+------------+ | 9 | rahul | mysore | 60000 | india | 04-04-2024 | +---+-------+--------+-------+-------+------------+ | 9 | rahul | mysore | 60000 | india | 04-04-2024 | +---+-------+--------+-------+-------+------------+ 1 row in set (0.001 sec) MariaDB [hima]> insert into salesman(salesman_id,name,city,comission,country,date) -> values(9,'rahul','mysore',60000,'india','04-04-2024'); Query OK, 1 row affected, 1 warning (0.003 sec) MariaDB [hima]> select * from salesman; +-------------+-------+--------+-----------+---------+------------+ | salesman_id | name | city | comission | country | date | +-------------+-------+--------+-----------+---------+------------+ | 1 | Ram | Paris | 46600 | NULL | NULL | | 2 | Ramya | Britan | 20034 | NULL | NULL | | 3 | Ram | Paris | 46600 | NULL | NULL | | 4 | Ramya | Britan | 20034 | NULL | NULL | | 5 | Ramya | Britan | 20034 | NULL | NULL | | 6 | Ramya | Britan | 20034 | NULL | NULL | | 7 | Ramya | Britan | 20034 | NULL | NULL | | 8 | rahul | mysore | 60000 | india | 0000-00-00 | | 9 | rahul | mysore | 60000 | india | 0000-00-00 | +-------------+-------+--------+-----------+---------+------------+ 9 rows in set (0.001 sec) MariaDB [hima]> update salesman set name="Ammu" where id= -> 2; ERROR 1054 (42S22): Unknown column 'id' in 'where clause' MariaDB [hima]> update salesman set name="Ammu" where salesman_id=2; Query OK, 1 row affected (0.004 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [hima]> select * from salesman; +-------------+-------+--------+-----------+---------+------------+ | salesman_id | name | city | comission | country | date | +-------------+-------+--------+-----------+---------+------------+ | 1 | Ram | Paris | 46600 | NULL | NULL | | 2 | Ammu | Britan | 20034 | NULL | NULL | | 3 | Ram | Paris | 46600 | NULL | NULL | | 4 | Ramya | Britan | 20034 | NULL | NULL | | 5 | Ramya | Britan | 20034 | NULL | NULL | | 6 | Ramya | Britan | 20034 | NULL | NULL | | 7 | Ramya | Britan | 20034 | NULL | NULL | | 8 | rahul | mysore | 60000 | india | 0000-00-00 | | 9 | rahul | mysore | 60000 | india | 0000-00-00 | +-------------+-------+--------+-----------+---------+------------+ 9 rows in set (0.001 sec) MariaDB [hima]> create table orders(ord_no int(11),purch_amt int(12),ord_date int(11),ord_id int(11),salesmans_id int(11)); Query OK, 0 rows affected (0.016 sec) MariaDB [hima]> show tables; +----------------+ | Tables_in_hima | +----------------+ | orders | | salesman | | students | +----------------+ 3 rows in set (0.001 sec) MariaDB [hima]> insert into orders(ord_no,purch_amt,ord_date,ord_id,salesmans_id) -> values(1,1000,5/10/20011,5000,100), -> (2,2000,5/12/2001,5001,112), -> (3,4000,10/12/2020,5002,345), -> (4,1324,12/1/2000,5003,431), -> (5,1334,1/1/2010,5004,125), -> (6,1734,8/5/2004,5005,175), -> (7,1764,18/5/2007,5006,775), -> (8,1265,10/7/2003,5007,215), -> (9,1535,13/7/2013,5008,115), -> (10,1355,16/9/2023,5009,715); Query OK, 10 rows affected (0.009 sec) Records: 10 Duplicates: 0 Warnings: 0 MariaDB [hima]> select * from orders; +--------+-----------+----------+--------+--------------+ | ord_no | purch_amt | ord_date | ord_id | salesmans_id | +--------+-----------+----------+--------+--------------+ | 1 | 1000 | 0 | 5000 | 100 | | 2 | 2000 | 0 | 5001 | 112 | | 3 | 4000 | 0 | 5002 | 345 | | 4 | 1324 | 0 | 5003 | 431 | | 5 | 1334 | 0 | 5004 | 125 | | 6 | 1734 | 0 | 5005 | 175 | | 7 | 1764 | 0 | 5006 | 775 | | 8 | 1265 | 0 | 5007 | 215 | | 9 | 1535 | 0 | 5008 | 115 | | 10 | 1355 | 0 | 5009 | 715 | +--------+-----------+----------+--------+--------------+ 10 rows in set (0.001 sec) MariaDB [hima]> select ord_no,purch_amt,ord_date from orders where ord_id='5001'; +--------+-----------+----------+ | ord_no | purch_amt | ord_date | +--------+-----------+----------+ | 2 | 2000 | 0 | +--------+-----------+----------+ 1 row in set (0.005 sec) MariaDB [hima]> update orders set ord_date=2001 where ord_no='1'; Query OK, 1 row affected (0.004 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [hima]> update orders set ord_date=2002 where ord_no='2'; Query OK, 1 row affected (0.003 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [hima]> select * from orders; +--------+-----------+----------+--------+--------------+ | ord_no | purch_amt | ord_date | ord_id | salesmans_id | +--------+-----------+----------+--------+--------------+ | 1 | 1000 | 2001 | 5000 | 100 | | 2 | 2000 | 2002 | 5001 | 112 | | 3 | 4000 | 0 | 5002 | 345 | | 4 | 1324 | 0 | 5003 | 431 | | 5 | 1334 | 0 | 5004 | 125 | | 6 | 1734 | 0 | 5005 | 175 | | 7 | 1764 | 0 | 5006 | 775 | | 8 | 1265 | 0 | 5007 | 215 | | 9 | 1535 | 0 | 5008 | 115 | | 10 | 1355 | 0 | 5009 | 715 | +--------+-----------+----------+--------+--------------+ 10 rows in set (0.001 sec)