NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Microsoft Windows [Version 10.0.19041.508]
(c) 2020 Microsoft Corporation. All rights reserved.

C:UsersAB>D:

D:>cd xamppmysqlbin

D:xamppmysqlbin>mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 8
Server version: 10.4.8-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| asuult |
| forumapp |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| surguuli |
+--------------------+
7 rows in set (0.071 sec)

MariaDB [(none)]> use surguuli;
Database changed
MariaDB [surguuli]> show tables;
+--------------------+
| Tables_in_surguuli |
+--------------------+
| surguuli |
+--------------------+
1 row in set (0.001 sec)

MariaDB [surguuli]> select * from surguuli
-> ;
+------+--------+------+------------+------+--------------------+
| id | name | age | regid | jin | hayg |
+------+--------+------+------------+------+--------------------+
| 1 | tergel | 14 | EE12378327 | 12.5 | bgd |
| 2 | sainaa | 15 | ER12312312 | 55.6 | shd |
| 5 | ynjmaa | 65 | OO20121200 | 81 | svkh-baatar duureg |
+------+--------+------+------------+------+--------------------+
3 rows in set (0.063 sec)

MariaDB [surguuli]> create table users (id int, name varchar(50), regid int, birthday varchar(20));
Query OK, 0 rows affected (0.685 sec)

MariaDB [surguuli]> describe users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| regid | int(11) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.061 sec)

MariaDB [surguuli]> alter table users update regid rd varchar(20);
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 'update regid rd varchar(20)' at line 1
MariaDB [surguuli]> alter table users column regid rd varchar(20);
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 'column regid rd varchar(20)' at line 1
MariaDB [surguuli]> alter table users regid rd varchar(20);
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 'rd varchar(20)' at line 1
MariaDB [surguuli]> alter table users change regid rd varchar(20);
Query OK, 0 rows affected (0.960 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> describe users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| rd | varchar(20) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.030 sec)

MariaDB [surguuli]> alter table users change rd rd int;
Query OK, 0 rows affected (0.749 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> describe users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| rd | int(11) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.033 sec)

MariaDB [surguuli]> alter table users change rd regid int;
Query OK, 0 rows affected (0.448 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> alter table users add age int after name;
Query OK, 0 rows affected (0.433 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> desc users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| regid | int(11) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
5 rows in set (0.027 sec)

MariaDB [surguuli]> alter table users add age int;
ERROR 1060 (42S21): Duplicate column name 'age'
MariaDB [surguuli]> alter table users add test int;
Query OK, 0 rows affected (0.439 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> desc users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| regid | int(11) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
| test | int(11) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
6 rows in set (0.029 sec)

MariaDB [surguuli]> alter table users drop column test;
Query OK, 0 rows affected (0.397 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> desc users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| regid | int(11) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
5 rows in set (0.026 sec)

MariaDB [surguuli]> alter table users change regid regid varchar(20);
Query OK, 0 rows affected (1.035 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> alter table users add gender char(1);
Query OK, 0 rows affected (0.407 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> alter table users add dep varchar varchar(2) after regid;
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 'varchar(2) after regid' at line 1
MariaDB [surguuli]> alter table users add dep varchar(2) after regid;
Query OK, 0 rows affected (0.419 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> desc users;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| regid | varchar(20) | YES | | NULL | |
| dep | varchar(2) | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
| gender | char(1) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
7 rows in set (0.026 sec)

MariaDB [surguuli]> insert into users values
-> (1, 'eeee', 10, 'EE12332134', 'cs', '2020-10-10', 'm');
Query OK, 1 row affected (0.462 sec)

MariaDB [surguuli]> select * from users;
+------+------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
+------+------+------+------------+------+------------+--------+
1 row in set (0.000 sec)

MariaDB [surguuli]> insert into users values
-> (2, 'haliun', 19, 'ER12332134', 'mm', '2015-10-10', 'f');
Query OK, 1 row affected (0.411 sec)

MariaDB [surguuli]> select * from users;
+------+--------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
| 2 | haliun | 19 | ER12332134 | mm | 2015-10-10 | f |
+------+--------+------+------------+------+------------+--------+
2 rows in set (0.000 sec)

MariaDB [surguuli]> select * from users where dep in ('cs');
+------+------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
+------+------+------+------------+------+------------+--------+
1 row in set (0.325 sec)

MariaDB [surguuli]> select * from users where gender in ('m');
+------+------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
+------+------+------+------------+------+------------+--------+
1 row in set (0.000 sec)

MariaDB [surguuli]> select * from users where gender in ('m', 'f');
+------+--------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
| 2 | haliun | 19 | ER12332134 | mm | 2015-10-10 | f |
+------+--------+------+------------+------+------------+--------+
2 rows in set (0.054 sec)

MariaDB [surguuli]> select * from users where dep in ('cs', 'mm');
'>
'> ;
'> ';
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
MariaDB [surguuli]> select * from users where dep in ('cs', 'mm');
+------+--------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
| 2 | haliun | 19 | ER12332134 | mm | 2015-10-10 | f |
+------+--------+------+------------+------+------------+--------+
2 rows in set (0.000 sec)

MariaDB [surguuli]> select * from users where dep not in ('cs');
+------+--------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+------------+------+------------+--------+
| 2 | haliun | 19 | ER12332134 | mm | 2015-10-10 | f |
+------+--------+------+------------+------+------------+--------+
1 row in set (0.000 sec)

MariaDB [surguuli]> insert into users values (3, 'gerlee', 20, 'TT098890', 'ic', null, 'f');
Query OK, 1 row affected (0.400 sec)

MariaDB [surguuli]> select * from users;
+------+--------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
| 2 | haliun | 19 | ER12332134 | mm | 2015-10-10 | f |
| 3 | gerlee | 20 | TT098890 | ic | NULL | f |
+------+--------+------+------------+------+------------+--------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> select * from users where birthday is null;
+------+--------+------+----------+------+----------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+----------+------+----------+--------+
| 3 | gerlee | 20 | TT098890 | ic | NULL | f |
+------+--------+------+----------+------+----------+--------+
1 row in set (0.304 sec)

MariaDB [surguuli]> select * from users where birthday null;
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 'null' at line 1
MariaDB [surguuli]> select * from users where birthday not null;
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 'null' at line 1
MariaDB [surguuli]> select * from users where birthday is not null;
+------+--------+------+------------+------+------------+--------+
| id | name | age | regid | dep | birthday | gender |
+------+--------+------+------------+------+------------+--------+
| 1 | eeee | 10 | EE12332134 | cs | 2020-10-10 | m |
| 2 | haliun | 19 | ER12332134 | mm | 2015-10-10 | f |
+------+--------+------+------------+------+------------+--------+
2 rows in set (0.000 sec)

MariaDB [surguuli]> show tables;
+--------------------+
| Tables_in_surguuli |
+--------------------+
| surguuli |
| users |
+--------------------+
2 rows in set (0.001 sec)

MariaDB [surguuli]> create table students (id int not null primary key, name varchar(20));
Query OK, 0 rows affected (0.606 sec)

MariaDB [surguuli]> desc students;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| name | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.064 sec)

MariaDB [surguuli]> insert into students (id, name) values (null, 'tergel');
ERROR 1048 (23000): Column 'id' cannot be null
MariaDB [surguuli]> insert into students (id, name) values (1, 'tergel');
Query OK, 1 row affected (0.407 sec)

MariaDB [surguuli]> select * from students;
+----+--------+
| id | name |
+----+--------+
| 1 | tergel |
+----+--------+
1 row in set (0.000 sec)

MariaDB [surguuli]> insert into students (id, name) values (1, 'sainaa');
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
MariaDB [surguuli]> alter table students change id id int not null primary key auto_increment;
ERROR 1068 (42000): Multiple primary key defined
MariaDB [surguuli]> drop table students;
Query OK, 0 rows affected (0.572 sec)

MariaDB [surguuli]> create table students (id int not null primary key auto_increment, name varchar(20));
Query OK, 0 rows affected (0.101 sec)

MariaDB [surguuli]> desc students;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.026 sec)

MariaDB [surguuli]> insert into students (id, name) values (null, 'sainaa');
Query OK, 1 row affected (0.385 sec)

MariaDB [surguuli]> select * from students;
+----+--------+
| id | name |
+----+--------+
| 1 | sainaa |
+----+--------+
1 row in set (0.000 sec)

MariaDB [surguuli]> insert into students (id, name) values (null, 'sainaa');
Query OK, 1 row affected (0.387 sec)

MariaDB [surguuli]> select * from students;
+----+--------+
| id | name |
+----+--------+
| 1 | sainaa |
| 2 | sainaa |
+----+--------+
2 rows in set (0.000 sec)

MariaDB [surguuli]> insert into students (id, name) values (1, 'sainaa');
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
MariaDB [surguuli]> insert into students (name) values ('saishaa');
Query OK, 1 row affected (0.399 sec)

MariaDB [surguuli]> select * from students;
+----+---------+
| id | name |
+----+---------+
| 1 | sainaa |
| 2 | sainaa |
| 3 | saishaa |
+----+---------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> select * from students;
+----+---------+
| id | name |
+----+---------+
| 1 | sainaa |
| 2 | sainaa |
| 3 | saishaa |
+----+---------+
3 rows in set (0.001 sec)

MariaDB [surguuli]> alter table students add dep int;
Query OK, 0 rows affected (0.436 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> desc students;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | YES | | NULL | |
| dep | int(11) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
3 rows in set (0.024 sec)

MariaDB [surguuli]> create table dep (id int not null auto_increment, name varchar(20), primary key(id));
Query OK, 0 rows affected (0.466 sec)

MariaDB [surguuli]> desc dep;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.058 sec)

MariaDB [surguuli]> insert into dep (name) values ('cs'), ('mm'),('ic');
Query OK, 3 rows affected (0.387 sec)
Records: 3 Duplicates: 0 Warnings: 0

MariaDB [surguuli]> select * from dep;
+----+------+
| id | name |
+----+------+
| 1 | cs |
| 2 | mm |
| 3 | ic |
+----+------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> desc students;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | YES | | NULL | |
| dep | int(11) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
3 rows in set (0.025 sec)

MariaDB [surguuli]> select * from students;
+----+---------+------+
| id | name | dep |
+----+---------+------+
| 1 | sainaa | NULL |
| 2 | sainaa | NULL |
| 3 | saishaa | NULL |
+----+---------+------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> update students set dep = 3 where id = 1;
Query OK, 1 row affected (0.403 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [surguuli]> update students set dep = 2 where id = 2;
Query OK, 1 row affected (0.035 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [surguuli]> update students set dep = 3 where id = 3;
Query OK, 1 row affected (0.035 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [surguuli]> select * from students;
+----+---------+------+
| id | name | dep |
+----+---------+------+
| 1 | sainaa | 3 |
| 2 | sainaa | 2 |
| 3 | saishaa | 3 |
+----+---------+------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> select * from students, dep
-> ;
+----+---------+------+----+------+
| id | name | dep | id | name |
+----+---------+------+----+------+
| 1 | sainaa | 3 | 1 | cs |
| 2 | sainaa | 2 | 1 | cs |
| 3 | saishaa | 3 | 1 | cs |
| 1 | sainaa | 3 | 2 | mm |
| 2 | sainaa | 2 | 2 | mm |
| 3 | saishaa | 3 | 2 | mm |
| 1 | sainaa | 3 | 3 | ic |
| 2 | sainaa | 2 | 3 | ic |
| 3 | saishaa | 3 | 3 | ic |
+----+---------+------+----+------+
9 rows in set (0.303 sec)

MariaDB [surguuli]> select * from students, dep where students.dep = dep.id;
+----+---------+------+----+------+
| id | name | dep | id | name |
+----+---------+------+----+------+
| 2 | sainaa | 2 | 2 | mm |
| 1 | sainaa | 3 | 3 | ic |
| 3 | saishaa | 3 | 3 | ic |
+----+---------+------+----+------+
3 rows in set (0.310 sec)

MariaDB [surguuli]> select students.name, dep.name from students, dep where students.dep = dep.id;
+---------+------+
| name | name |
+---------+------+
| sainaa | mm |
| sainaa | ic |
| saishaa | ic |
+---------+------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> select * from dep;
+----+------+
| id | name |
+----+------+
| 1 | cs |
| 2 | mm |
| 3 | ic |
+----+------+
3 rows in set (0.000 sec)

MariaDB [surguuli]> select * from students;
+----+---------+------+
| id | name | dep |
+----+---------+------+
| 1 | sainaa | 3 |
| 2 | sainaa | 2 |
| 3 | saishaa | 3 |
+----+---------+------+
3 rows in set (0.000 sec)

MariaDB [surguuli]>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.