NellyIvanova29

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

Oct 25th, 2021
900
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Microsoft Windows [Version 10.0.19042.928]
  2. (c) Microsoft Corporation. All rights reserved.
  3.  
  4. C:\Users\nelly> mysql - uroot
  5. mysql  Ver 15.1 Distrib 10.4.21-MariaDB, for Win64 (AMD64), source revision 4902b0fdc91cc6dc169dd2322daf966a2eeafdd8
  6. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  7.  
  8. Usage: mysql [OPTIONS] [database]
  9.  
  10. Default options are read from the following files in the given order:
  11. C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\my.cnf C:\xampp\mysql\my.ini C:\xampp\mysql\my.cnf C:\xampp\mysql\data\my.ini C:\xampp\mysql\data\my.cnf
  12. The following groups are read: mysql mariadb-client client client-server client-mariadb
  13. The following options may be given as the first argument:
  14. --print-defaults          Print the program argument list and exit.
  15. --no-defaults             Don't read default options from any option file.
  16. The following specify which files/extra groups are read (specified before remaining options):
  17. --defaults-file=#         Only read default options from the given file #.
  18. --defaults-extra-file=#   Read this file after the global files are read.
  19. --defaults-group-suffix=# Additionally read default groups with # appended as a suffix.
  20.  
  21.  -?, --help          Display this help and exit.
  22.  -I, --help          Synonym for -?
  23.  --abort-source-on-error
  24.                      Abort 'source filename' operations in case of errors
  25.  --auto-rehash       Enable automatic rehashing. One doesn't need to use
  26.                       'rehash' to get table and field completion, but startup
  27.                       and reconnecting may take a longer time. Disable with
  28.                       --disable-auto-rehash.
  29.                       (Defaults to on; use --skip-auto-rehash to disable.)
  30.   -A, --no-auto-rehash
  31.                       No automatic rehashing. One has to use 'rehash' to get
  32.                       table and field completion. This gives a quicker start of
  33.                       mysql and disables rehashing on reconnect.
  34.   --auto-vertical-output
  35.                       Automatically switch to vertical output mode if the
  36.                       result is wider than the terminal width.
  37.   -B, --batch         Don't use history file. Disable interactive behavior.
  38.                      (Enables --silent.)
  39.  --binary-as-hex     Print binary data as hex
  40.  --character-sets-dir=name
  41.                      Directory for character set files.
  42.  --column-type-info  Display column type information.
  43.  -c, --comments      Preserve comments. Send comments to the server. The
  44.                      default is --skip-comments (discard comments), enable
  45.                      with --comments.
  46.  -C, --compress      Use compression in server/client protocol.
  47.  -#, --debug[=#]     This is a non-debug version. Catch this and exit.
  48.  --debug-check       Check memory and open file usage at exit.
  49.  -T, --debug-info    Print some debug info at exit.
  50.  -D, --database=name Database to use.
  51.  --default-character-set=name
  52.                      Set the default character set.
  53.  --delimiter=name    Delimiter to be used.
  54.  -e, --execute=name  Execute command and quit. (Disables --force and history
  55.                      file.)
  56.  -E, --vertical      Print the output of a query (rows) vertically.
  57.  -f, --force         Continue even if we get an SQL error. Sets
  58.                      abort-source-on-error to 0
  59.  -G, --named-commands
  60.                      Enable named commands. Named commands mean this program's
  61.                       internal commands; see mysql> help . When enabled, the
  62.                       named commands can be used from any line of the query,
  63.                       otherwise only from the first line, before an enter.
  64.                       Disable with --disable-named-commands. This option is
  65.                       disabled by default.
  66.   -i, --ignore-spaces Ignore space after function names.
  67.   --init-command=name SQL Command to execute when connecting to MariaDB server.
  68.                       Will automatically be re-executed when reconnecting.
  69.   --local-infile      Enable/disable LOAD DATA LOCAL INFILE.
  70.   -b, --no-beep       Turn off beep on error.
  71.   -h, --host=name     Connect to host.
  72.   -H, --html          Produce HTML output.
  73.   -X, --xml           Produce XML output.
  74.   --line-numbers      Write line numbers for errors.
  75.                       (Defaults to on; use --skip-line-numbers to disable.)
  76.   -L, --skip-line-numbers
  77.                       Don't write line number for errors.
  78.  -n, --unbuffered    Flush buffer after each query.
  79.  --column-names      Write column names in results.
  80.                      (Defaults to on; use --skip-column-names to disable.)
  81.  -N, --skip-column-names
  82.                      Don't write column names in results.
  83.   --sigint-ignore     Ignore SIGINT (CTRL-C).
  84.   -o, --one-database  Ignore statements except those that occur while the
  85.                       default database is the one named at the command line.
  86.   -p, --password[=name]
  87.                       Password to use when connecting to server. If password is
  88.                       not given it's asked from the tty.
  89.  -W, --pipe          Use named pipes to connect to server.
  90.  -P, --port=#        Port number to use for connection or 0 for default to, in
  91.                      order of preference, my.cnf, $MYSQL_TCP_PORT,
  92.                      /etc/services, built-in default (3306).
  93.  --progress-reports  Get progress reports for long running commands (like
  94.                      ALTER TABLE)
  95.                      (Defaults to on; use --skip-progress-reports to disable.)
  96.  --prompt=name       Set the command line prompt to this value.
  97.  --protocol=name     The protocol to use for connection (tcp, socket, pipe).
  98.  -q, --quick         Don't cache result, print it row by row. This may slow
  99.                       down the server if the output is suspended. Doesn't use
  100.                      history file.
  101.  -r, --raw           Write fields without conversion. Used with --batch.
  102.  --reconnect         Reconnect if the connection is lost. Disable with
  103.                      --disable-reconnect. This option is enabled by default.
  104.                      (Defaults to on; use --skip-reconnect to disable.)
  105.  -s, --silent        Be more silent. Print results with a tab as separator,
  106.                      each row on new line.
  107.  -S, --socket=name   The socket file to use for connection.
  108.  --ssl               Enable SSL for connection (automatically enabled with
  109.                      other flags).
  110.  --ssl-ca=name       CA file in PEM format (check OpenSSL docs, implies
  111.                      --ssl).
  112.  --ssl-capath=name   CA directory (check OpenSSL docs, implies --ssl).
  113.  --ssl-cert=name     X509 cert in PEM format (implies --ssl).
  114.  --ssl-cipher=name   SSL cipher to use (implies --ssl).
  115.  --ssl-key=name      X509 key in PEM format (implies --ssl).
  116.  --ssl-crl=name      Certificate revocation list (implies --ssl).
  117.  --ssl-crlpath=name  Certificate revocation list path (implies --ssl).
  118.  --tls-version=name  TLS protocol version for secure connection.
  119.  --ssl-verify-server-cert
  120.                      Verify server's "Common Name" in its cert against
  121.                       hostname used when connecting. This option is disabled by
  122.                       default.
  123.   -t, --table         Output in table format.
  124.   --tee=name          Append everything into outfile. See interactive help (\h)
  125.                       also. Does not work in batch mode. Disable with
  126.                       --disable-tee. This option is disabled by default.
  127.   -u, --user=name     User for login if not current user.
  128.   -U, --safe-updates  Only allow UPDATE and DELETE that uses keys.
  129.   -U, --i-am-a-dummy  Synonym for option --safe-updates, -U.
  130.   -v, --verbose       Write more. (-v -v -v gives the table output format).
  131.   -V, --version       Output version information and exit.
  132.   -w, --wait          Wait and retry if connection is down.
  133.   --connect-timeout=# Number of seconds before connection timeout.
  134.   --max-allowed-packet=#
  135.                       The maximum packet length to send to or receive from
  136.                       server.
  137.   --net-buffer-length=#
  138.                       The buffer size for TCP/IP and socket communication.
  139.   --select-limit=#    Automatic limit for SELECT when using --safe-updates.
  140.   --max-join-size=#   Automatic limit for rows in a join when using
  141.                       --safe-updates.
  142.   --secure-auth       Refuse client connecting to server if it uses old
  143.                       (pre-4.1.1) protocol.
  144.   --server-arg=name   Send embedded server this as a parameter.
  145.   --show-warnings     Show warnings after every statement.
  146.   --plugin-dir=name   Directory for client-side plugins.
  147.   --default-auth=name Default authentication client-side plugin to use.
  148.   --binary-mode       By default, ASCII '\0' is disallowed and '\r\n' is
  149.                       translated to '\n'. This switch turns off both features,
  150.                       and also turns off parsing of all clientcommands except
  151.                       \C and DELIMITER, in non-interactive mode (for input
  152.                       piped to mysql or loaded using the 'source' command).
  153.                       This is necessary when processing output from mysqlbinlog
  154.                       that may contain blobs.
  155.   --connect-expired-password
  156.                       Notify the server that this client is prepared to handle
  157.                       expired password sandbox mode even if --batch was
  158.                       specified.
  159.  
  160. Variables (--variable-name=value)
  161. and boolean options {FALSE|TRUE}  Value (after reading options)
  162. --------------------------------- ----------------------------------------
  163. abort-source-on-error             FALSE
  164. auto-rehash                       TRUE
  165. auto-vertical-output              FALSE
  166. binary-as-hex                     FALSE
  167. character-sets-dir                (No default value)
  168. column-type-info                  FALSE
  169. comments                          FALSE
  170. compress                          FALSE
  171. debug-check                       FALSE
  172. debug-info                        FALSE
  173. database                          (No default value)
  174. default-character-set             auto
  175. delimiter                         ;
  176. vertical                          FALSE
  177. force                             FALSE
  178. named-commands                    FALSE
  179. ignore-spaces                     FALSE
  180. init-command                      (No default value)
  181. local-infile                      FALSE
  182. no-beep                           FALSE
  183. host                              (No default value)
  184. html                              FALSE
  185. xml                               FALSE
  186. line-numbers                      TRUE
  187. unbuffered                        FALSE
  188. column-names                      TRUE
  189. sigint-ignore                     FALSE
  190. port                              0
  191. progress-reports                  TRUE
  192. prompt                            \N [\d]>
  193. protocol
  194. quick                             FALSE
  195. raw                               FALSE
  196. reconnect                         TRUE
  197. socket                            (No default value)
  198. ssl                               FALSE
  199. ssl-ca                            (No default value)
  200. ssl-capath                        (No default value)
  201. ssl-cert                          (No default value)
  202. ssl-cipher                        (No default value)
  203. ssl-key                           (No default value)
  204. ssl-crl                           (No default value)
  205. ssl-crlpath                       (No default value)
  206. tls-version                       (No default value)
  207. ssl-verify-server-cert            FALSE
  208. table                             FALSE
  209. user                              (No default value)
  210. safe-updates                      FALSE
  211. i-am-a-dummy                      FALSE
  212. connect-timeout                   0
  213. max-allowed-packet                16777216
  214. net-buffer-length                 16384
  215. select-limit                      1000
  216. max-join-size                     1000000
  217. secure-auth                       FALSE
  218. show-warnings                     FALSE
  219. plugin-dir                        (No default value)
  220. default-auth                      (No default value)
  221. binary-mode                       FALSE
  222. connect-expired-password          FALSE
  223.  
  224. C:\Users\nelly>mysql -uroot
  225. Welcome to the MariaDB monitor.  Commands end with ; or \g.
  226. Your MariaDB connection id is 16
  227. Server version: 10.4.21-MariaDB mariadb.org binary distribution
  228.  
  229. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  230.  
  231. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  232.  
  233. MariaDB [(none)]> show databases;
  234. +--------------------+
  235. | Database           |
  236. +--------------------+
  237. | information_schema |
  238. | mysql              |
  239. | performance_schema |
  240. | phpmyadmin         |
  241. | shoot              |
  242. | test               |
  243. +--------------------+
  244. 6 rows in set (0.013 sec)
  245.  
  246. MariaDB [(none)]> use test;
  247. Database changed
  248. MariaDB [test]> show tables;
  249. Empty set (0.001 sec)
  250.  
  251. MariaDB [test]> create database Reservations;
  252. Query OK, 1 row affected (0.024 sec)
  253.  
  254. MariaDB [test]> select Reservations;
  255. ERROR 1054 (42S22): Unknown column 'Reservations' in 'field list'
  256. MariaDB [test]> use Reservations;
  257. Database changed
  258. MariaDB [Reservations]> Create Table
  259.     -> ;
  260. 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
  261. MariaDB [Reservations]>
  262. MariaDB [Reservations]>
  263. MariaDB [Reservations]> Create Table Agency(name VARCHAR(100) NOT NULL, city VARCHAR (100) NOT NULL, country VARCHAR (100) NOT NULL, telnum VARCHAR (10) NOT NULL);
  264. Query OK, 0 rows affected (0.023 sec)
  265.  
  266. MariaDB [Reservations]> SHOW TABLES
  267.     -> show Agency
  268.     ->
  269.     ->
  270.     ->
  271.     -> ;
  272. 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 'show Agency' at line 2
  273. MariaDB [Reservations]> Show tables
  274.     -> INSERT INTO Agency
  275.     -> ;
  276. 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 'INSERT INTO Agency' at line 2
  277. MariaDB [Reservations]> IMSERT INTO Agency
  278.     -> shoe
  279.     -> cpnds
  280.     -> sdn;
  281. 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 'IMSERT INTO Agency
  282. shoe
  283. cpnds
  284. sdn' at line 1
  285. MariaDB [Reservations]> create table Agency(
  286.     -> name VARCHAR (100) NOT NULL,
  287.     -> city VARCHAR (100) NOT NULL,
  288.     -> country VARCHAR(100) NOT NULL,
  289.     -> telnum CHAR (10) NOT NULL);
  290. ERROR 1050 (42S01): Table 'agency' already exists
  291. MariaDB [Reservations]> SHOW AGENCY
  292.     -> ;
  293. 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 'AGENCY' at line 1
  294. MariaDB [Reservations]> INSERT INTO AGENCY
  295.     -> (name, city, country, telnum)
  296.     -> VALUES ('Nelly', 'Radnevo', 'Bulgaria', '0894080007');
  297. Query OK, 1 row affected (0.026 sec)
  298.  
  299. MariaDB [Reservations]> INSERT INTO AGENCY
  300.     -> (name, city, country, telnum)
  301.     -> VALUES ('Gaby', 'Stara Zagora', 'Bulgaria', '0888693322');
  302. Query OK, 1 row affected (0.008 sec)
  303.  
  304. MariaDB [Reservations]> SELECT *FROM Agency;
  305. +-------+--------------+----------+------------+
  306. | name  | city         | country  | telnum     |
  307. +-------+--------------+----------+------------+
  308. | Nelly | Radnevo      | Bulgaria | 0894080007 |
  309. | Gaby  | Stara Zagora | Bulgaria | 0888693322 |
  310. +-------+--------------+----------+------------+
  311. 2 rows in set (0.002 sec)
  312.  
  313. MariaDB [Reservations]> CREATE TABLE Clients(
  314.     -> egn CHAR (10) NOT NULL,
  315.     -> name VARCHAR (100) NOT NULL,
  316.     -> telnum CHAR (10) NOT NULL,
  317.     -> email VARCHAR (100) NOT NULL);
  318. Query OK, 0 rows affected (0.012 sec)
  319.  
  320. MariaDB [Reservations]> INSERT INTO Clients
  321.     -> (egn, name, telnum, email)
  322.     -> VALUES ('0341297531', 'Nelly', '0894080007', 'nelly@gmail.com');
  323. Query OK, 1 row affected (0.004 sec)
  324.  
  325. MariaDB [Reservations]> INSERT INTO Clients
  326.     -> (egn, name, telnum, email)
  327.     -> VALUES ('0350287532','Gaby','0899693322','gaby@gmail.com');
  328. Query OK, 1 row affected (0.002 sec)
  329.  
  330. MariaDB [Reservations]> Create table RES(
  331.     -> agencyname VARCHAR (100) NOT NULL,
  332.     -> egn CHAR (10) NOT NULL,
  333.     -> date VARCHAR (10) NOT NULL,
  334.     -> status VARCHAR (100) NOT NULL);
  335. Query OK, 0 rows affected (0.010 sec)
  336.  
  337. MariaDB [Reservations]> INSERT INTO RES
  338.     -> (agencyname, egn, date, status)
  339.     -> VALUES ('Softadev','0341297531','28.10.2021','expecting');
  340. Query OK, 1 row affected (0.007 sec)
  341.  
  342. MariaDB [Reservations]> SELECT * FROM RES
  343.     -> ;
  344. +------------+------------+------------+-----------+
  345. | agencyname | egn        | date       | status    |
  346. +------------+------------+------------+-----------+
  347. | Softadev   | 0341297531 | 28.10.2021 | expecting |
  348. +------------+------------+------------+-----------+
  349. 1 row in set (0.001 sec)
  350.  
  351. MariaDB [Reservations]> Bye
  352. Ctrl-C -- exit!
  353.  
  354. C:\Users\nelly>
RAW Paste Data