Advertisement
NellyIvanova29

MySQL Практикум 1 ЗАД.2

Oct 26th, 2021
938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 3.94 KB | None | 0 0
  1. Microsoft Windows [Version 10.0.19043.1288]
  2. (c) Microsoft Corporation. All rights reserved.
  3.  
  4. C:\Users\nelly>mysql -u root
  5. Welcome to the MariaDB monitor.  Commands end with ; or \g.
  6. Your MariaDB connection id is 16
  7. Server version: 10.4.21-MariaDB mariadb.org binary distribution
  8.  
  9. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  10.  
  11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  12.  
  13. MariaDB [(none)]> show databases
  14.     -> ;
  15. +--------------------+
  16. | Database           |
  17. +--------------------+
  18. | information_schema |
  19. | mysql              |
  20. | performance_schema |
  21. | phpmyadmin         |
  22. | reservations       |
  23. | shoot              |
  24. | test               |
  25. +--------------------+
  26. 7 rows in set (0.015 sec)
  27.  
  28. MariaDB [(none)]> create database Uni;
  29. Query OK, 1 row affected (0.008 sec)
  30.  
  31. MariaDB [(none)]> use Uni;
  32. Database changed
  33. MariaDB [Uni]> create table departament(
  34.     -> depname VARCHAR (100) NOT NULL);
  35. Query OK, 0 rows affected (0.021 sec)
  36.  
  37. MariaDB [Uni]> create table proff(
  38.     -> egn CHAR (10) NOT NULL,
  39.     -> proffname VARCHAR (50) NOT NULL,
  40.     -> degree VARCHAR (100) NOT NULL,
  41.     -> title VARCHAR (100) NOT NULL,
  42.     -> depname VARCHAR (100) referances departament(depname));
  43. 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 'departament(depname))' at line 6
  44. MariaDB [Uni]> create table proff(
  45.     ->     -> egn CHAR (10) NOT NULL,
  46.     ->     -> proffname VARCHAR (50) NOT NULL,
  47.     ->     -> degree VARCHAR (100) NOT NULL,
  48.     ->     -> title VARCHAR (100) NOT NULL,
  49.     ->     -> depname VARCHAR (100) references departament(depname));
  50. 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 '-> egn CHAR (10) NOT NULL,
  51.    -> proffname VARCHAR (50) NOT NULL,
  52.    -> deg...' at line 2
  53. MariaDB [Uni]> create table proff(
  54.     ->     ->     -> egn CHAR (10) NOT NULL,
  55.     ->     ->     -> proffname VARCHAR (50) NOT NULL,
  56.     ->     ->     -> degree VARCHAR (100) NOT NULL,
  57.     ->     ->     -> title VARCHAR (100) NOT NULL,
  58.     -> ;
  59. 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 '->     -> egn CHAR (10) NOT NULL,
  60.    ->     -> proffname VARCHAR (50) NOT NU...' at line 2
  61. MariaDB [Uni]>
  62. MariaDB [Uni]> create table proff(
  63.     ->      egn CHAR (10) NOT NULL,
  64.     ->   proffname VARCHAR (50) NOT NULL,
  65.     ->    degree VARCHAR (100) NOT NULL,
  66.     ->  title VARCHAR (100) NOT NULL,
  67.     -> depname VARCHAR (100) references departament(depname));
  68. Query OK, 0 rows affected (0.016 sec)
  69.  
  70. MariaDB [Uni]> create table student(
  71.     -> egnstu CHAR (10) NOT NULL,
  72.     -> num CHAR (10) NOT NULL,
  73.     -> stuname VARCHAR (100) NOT NULL);
  74. Query OK, 0 rows affected (0.015 sec)
  75.  
  76. MariaDB [Uni]> create table class–
  77.     -> ;
  78. 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 '-' at line 1
  79. MariaDB [Uni]> create table class(
  80.     -> classnum CHAR (5) NOT NULL,
  81.     -> classname VARCHAR (30) NOT NULL,
  82.     -> classdesc VARCHAR (100) NOT NULL,
  83.     -> egn CHAR (10) references proff(egn));
  84. Query OK, 0 rows affected (0.055 sec)
  85.  
  86. MariaDB [Uni]> create table attend(
  87.     -> egnstu CHAR (10) references students(egnstu)
  88.     -> classnum CHAR (5) references class(classnum));
  89. 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 'classnum CHAR (5) references class(classnum))' at line 3
  90. MariaDB [Uni]> create table attend(
  91.     -> egnstu CHAR (10) references students(egnstu),
  92.     -> classnum CHAR (5) references class(classnum));
  93. Query OK, 0 rows affected (0.011 sec)
  94.  
  95. MariaDB [Uni]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement