0% found this document useful (0 votes)
3 views3 pages

Terminal Saved Output

The document details a user's interaction with a MySQL database, including logging in, showing databases and tables, and attempting to alter and delete records. The user encounters several SQL syntax errors while trying to execute commands. Ultimately, the structure of the 'users' table is displayed multiple times, confirming its existence and fields.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Terminal Saved Output

The document details a user's interaction with a MySQL database, including logging in, showing databases and tables, and attempting to alter and delete records. The user encounters several SQL syntax errors while trying to execute commands. Ultimately, the structure of the 'users' table is displayed multiple times, confirming its existence and fields.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Last login: Sun Jan 12 18:09:31 on ttys000

bhaveshsingh@Bhaveshs-MacBook-Air ~ % SHOW TABLES;

zsh: command not found: SHOW


bhaveshsingh@Bhaveshs-MacBook-Air ~ % 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> SHOW DATABASES;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| register |
| sys |
+--------------------+
5 rows in set (0.01 sec)

mysql> USE register;


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> SHOW TABLES;
+--------------------+
| Tables_in_register |
+--------------------+
| users |
+--------------------+
1 row in set (0.00 sec)

mysql> desc users;


+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | NULL | |
| email | varchar(255) | NO | UNI | NULL | |
| password | varchar(255) | NO | | NULL | |
| gender | varchar(50) | YES | | NULL | |
| city | varchar(255) | YES | | NULL | |
+----------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> DELETE FROM register WHERE id = ?;


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> ALTER TABLE register DROP COLUMN id;
ERROR 1146 (42S02): Table 'register.register' doesn't exist
mysql> SHOW TABLES;
+--------------------+
| Tables_in_register |
+--------------------+
| users |
+--------------------+
1 row in set (0.00 sec)

mysql> desc Tables_in_register


-> ;
ERROR 1146 (42S02): Table 'register.tables_in_register' doesn't exist
mysql> desc Tables_in_register;
ERROR 1146 (42S02): Table 'register.tables_in_register' doesn't exist
mysql> SHOW TABLES;
+--------------------+
| Tables_in_register |
+--------------------+
| users |
+--------------------+
1 row in set (0.01 sec)

mysql> desc users;


+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | NULL | |
| email | varchar(255) | NO | UNI | NULL | |
| password | varchar(255) | NO | | NULL | |
| gender | varchar(50) | YES | | NULL | |
| city | varchar(255) | YES | | NULL | |
+----------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> DELETE FROM users WHERE id = <id_value>;


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
'<id_value>' at line 1
mysql> ALTER TABLE users DROP COLUMN id;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> desc users;


+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| name | varchar(255) | NO | | NULL | |
| email | varchar(255) | NO | PRI | NULL | |
| password | varchar(255) | NO | | NULL | |
| gender | varchar(50) | YES | | NULL | |
| city | varchar(255) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> SHOW DATABASES;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| register |
| sys |
+--------------------+
5 rows in set (0.01 sec)

mysql> USE register;


Database changed
mysql> SHOW TABLES;
+--------------------+
| Tables_in_register |
+--------------------+
| users |
+--------------------+
1 row in set (0.00 sec)

mysql> CREATE TABLE users (


-> name VARCHAR(255) NOT NULL,
-> email VARCHAR(255) NOT NULL UNIQUE,
-> password VARCHAR(255) NOT NULL,
-> gender VARCHAR(50),
-> city VARCHAR(255)
->
-> );
ERROR 1050 (42S01): Table 'users' already exists
mysql> show users;
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 'users'
at line 1
mysql> SHOW TABLES;
+--------------------+
| Tables_in_register |
+--------------------+
| users |
+--------------------+
1 row in set (0.00 sec)

mysql> desc users;


+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| name | varchar(255) | NO | | NULL | |
| email | varchar(255) | NO | PRI | NULL | |
| password | varchar(255) | NO | | NULL | |
| gender | varchar(50) | YES | | NULL | |
| city | varchar(255) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
5 rows in set (0.01 sec)

mysql>

You might also like