Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 8.0.25 MySQL Community Server - GPL
Copyright (c) 2000, 2021, 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> use classimodesl;
ERROR 1049 (42000): Unknown database 'classimodesl'
mysql> use classimodesls;
ERROR 1049 (42000): Unknown database 'classimodesls'
mysql> use classicmodels;
Database changed
mysql> show tables;
+-------------------------+
| Tables_in_classicmodels |
+-------------------------+
| accounts |
| book |
| customers |
| employees |
| library |
| list |
| offices |
| orderdetails |
| orders |
| payments |
| productlines |
| products |
+-------------------------+
12 rows in set (0.01 sec)
mysql> show full tables;
+-------------------------+------------+
| Tables_in_classicmodels | Table_type |
+-------------------------+------------+
| accounts | BASE TABLE |
| book | BASE TABLE |
| customers | BASE TABLE |
| employees | BASE TABLE |
| library | BASE TABLE |
| list | VIEW |
| offices | BASE TABLE |
| orderdetails | BASE TABLE |
| orders | BASE TABLE |
| payments | BASE TABLE |
| productlines | BASE TABLE |
| products | BASE TABLE |
+-------------------------+------------+
12 rows in set (0.00 sec)
mysql> desc customers;
+------------------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+---------------+------+-----+---------+-------+
| customerNumber | int | NO | PRI | NULL | |
| customerName | varchar(50) | NO | | NULL | |
| contactLastName | varchar(50) | NO | | NULL | |
| contactFirstName | varchar(50) | NO | | NULL | |
| phone | varchar(50) | NO | | NULL | |
| addressLine1 | varchar(50) | NO | | NULL | |
| addressLine2 | varchar(50) | YES | | NULL | |
| city | varchar(50) | NO | | NULL | |
| state | varchar(50) | YES | | NULL | |
| postalCode | varchar(15) | YES | | NULL | |
| country | varchar(50) | NO | | NULL | |
| salesRepEmployeeNumber | int | YES | MUL | NULL | |
| creditLimit | decimal(10,2) | YES | | NULL | |
+------------------------+---------------+------+-----+---------+-------+
13 rows in set (0.10 sec)
mysql> desc orders;;
+----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| orderNumber | int | NO | PRI | NULL | |
| orderDate | date | NO | | NULL | |
| requiredDate | date | NO | | NULL | |
| shippedDate | date | YES | | NULL | |
| returneddate | year | YES | | NULL | |
| status | varchar(29) | YES | | NULL | |
| customerNumber | int | NO | MUL | NULL | |
+----------------+-------------+------+-----+---------+-------+
7 rows in set (0.00 sec)
ERROR:
No query specified
mysql> select cusromername,phone,city from customers limit 5;
ERROR 1054 (42S22): Unknown column 'cusromername' in 'field list'
mysql> select customername,phone,city from customers limit 5;
+----------------------------+--------------+-----------+
| customername | phone | city |
+----------------------------+--------------+-----------+
| Atelier graphique | 40.32.2555 | Nantes |
| Signal Gift Stores | 7025551838 | Las Vegas |
| Australian Collectors, Co. | 03 9520 4555 | Melbourne |
| La Rochelle Gifts | 40.67.8555 | Nantes |
| Baane Mini Imports | 07-98 9555 | Stavern |
+----------------------------+--------------+-----------+
5 rows in set (0.04 sec)
mysql> create view custview select customername,phone,city from customers;
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 'select customername,phone,city from customers' at line 1
mysql> create view custview as select customername,phone,city from customers;
Query OK, 0 rows affected (0.19 sec)
mysql> select * from custview limit 5;
+----------------------------+--------------+-----------+
| customername | phone | city |
+----------------------------+--------------+-----------+
| Atelier graphique | 40.32.2555 | Nantes |
| Signal Gift Stores | 7025551838 | Las Vegas |
| Australian Collectors, Co. | 03 9520 4555 | Melbourne |
| La Rochelle Gifts | 40.67.8555 | Nantes |
| Baane Mini Imports | 07-98 9555 | Stavern |
+----------------------------+--------------+-----------+
5 rows in set (0.00 sec)
mysql> select count(*) from custview;
+----------+
| count(*) |
+----------+
| 122 |
+----------+
1 row in set (0.00 sec)
mysql>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.