Last login: Sat Oct 19 14:06:24 on ttys000
manishpatidar@Manishs-MacBook-Pro-2 ~ % mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
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> status;
--------------
mysql Ver 9.0.1 for macos13.6 on arm64 (Homebrew)
Connection id: 20
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.40 MySQL Community Server - GPL
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /tmp/mysql.sock
Binary data as: Hexadecimal
Uptime: 8 hours 57 min 7 sec
Threads: 4 Questions: 360 Slow queries: 0 Opens: 291 Flush tables: 3 Open
tables: 205 Queries per second avg: 0.011
--------------
mysql> use db1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> ststus;
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 'ststus'
at line 1
mysql> status;
--------------
mysql Ver 9.0.1 for macos13.6 on arm64 (Homebrew)
Connection id: 20
Current database: db1
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.40 MySQL Community Server - GPL
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /tmp/mysql.sock
Binary data as: Hexadecimal
Uptime: 8 hours 57 min 26 sec
Threads: 4 Questions: 369 Slow queries: 0 Opens: 299 Flush tables: 3 Open
tables: 213 Queries per second avg: 0.011
--------------
mysql> show tables;
+---------------+
| Tables_in_db1 |
+---------------+
| student |
+---------------+
1 row in set (0.00 sec)
mysql> describe student;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int | NO | PRI | NULL | |
| fullname | varchar(25) | YES | | NULL | |
| age | int | NO | | NULL | |
| email | varchar(30) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.01 sec)
mysql> CREATE TABLE Project( varchar(225) name,mysql> ;
ERROR:
No query specified
mysql> CREATE TABLE Project(
-> project_id int,
-> project_name varchar(225),
-> project_title varchar(125),
-> incharge varchar(100)
-> ;
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 '' at
line 5
mysql> CREATE TABLE Project(
-> -> project_id int,
-> -> project_name varchar(225),
-> -> project_title varchar(125),
-> -> incharge int,
->
-> ;
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 '->
project_id int,
-> project_name varchar(225),
-> project_title varcha' at line 2
mysql> CREATE TABLE Project(
-> -> -> project_id int,
-> -> -> project_name varchar(225),
-> -> -> project_title varchar(125),
-> -> -> incharge int,
-> ->
-> ;
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 '-> -
> project_id int,
-> -> project_name varchar(225),
-> ->' at line 2
mysql> CREATE TABLE Project(
-> project_id int,
-> project_name varchar(225),
-> project_date int,
-> incharge int,
-> PRIMARY KEY (project_id),
-> CONSTRAINT FK_project FOREIGN KEY (incharge) REFERENCES student(id)
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> describe project;
+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| project_id | int | NO | PRI | NULL | |
| project_name | varchar(225) | YES | | NULL | |
| project_date | int | YES | | NULL | |
| incharge | int | YES | MUL | NULL | |
+--------------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
mysql> insert into Project(project_id,project_name,project_date,incharge)
-> values(1,'abc',12,1);
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint
fails (`db1`.`project`, CONSTRAINT `FK_project` FOREIGN KEY (`incharge`) REFERENCES
`student` (`id`))
mysql> insert into Project(project_id,project_name,project_date,incharge)
-> -> values(2,'abc',12,2);
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 '->
values(2,'abc',12,2)' at line 2
mysql> insert into Project(project_id,project_name,project_date,incharge)
-> values(2,'abc',12,2);
Query OK, 1 row affected (0.00 sec)
mysql> select *from Project;
+------------+--------------+--------------+----------+
| project_id | project_name | project_date | incharge |
+------------+--------------+--------------+----------+
| 2 | abc | 12 | 2 |
+------------+--------------+--------------+----------+
1 row in set (0.00 sec)
mysql> insert into Project(project_id,project_name,project_date,incharge)
-> values(3,'ab1',13,2);insert into
Project(project_id,project_name,project_date,incharge)
Query OK, 1 row affected (0.01 sec)
-> ;
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 '' at
line 1
mysql> select *from project;
+------------+--------------+--------------+----------+
| project_id | project_name | project_date | incharge |
+------------+--------------+--------------+----------+
| 2 | abc | 12 | 2 |
| 3 | ab1 | 13 | 2 |
+------------+--------------+--------------+----------+
2 rows in set (0.00 sec)
mysql> insert into Project(project_id,project_name,project_date,incharge)
-> values(4,'ab2',14,4);
Query OK, 1 row affected (0.00 sec)
mysql> select *from Project;
+------------+--------------+--------------+----------+
| project_id | project_name | project_date | incharge |
+------------+--------------+--------------+----------+
| 2 | abc | 12 | 2 |
| 3 | ab1 | 13 | 2 |
| 4 | ab2 | 14 | 4 |
+------------+--------------+--------------+----------+
3 rows in set (0.00 sec)
mysql>