Enter password: Welcome to the Mysql monitor. Commands end with; or \g. Your Mysql connection id is 3 Server version: 16 Mysql community Server (gpl) Copyright (c) 2000, 2014, Oracle and/or its affiliates


Download 35.01 Kb.
Sana10.05.2020
Hajmi35.01 Kb.
#104622
Bog'liq
lll


Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.16 MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 tatu Database changed mysql> selesct name from person; 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 'selesct name from person' at line 1 mysql> select name from person; +----------+ | name | +----------+ | Jahongir | | R | +----------+ 2 rows in set (0.00 sec) mysql> select where id = 1 from person; 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 'where id = 1 from person' at line 1 mysql> select name from person where id = 1; +----------+ | name | +----------+ | Jahongir | +----------+ 1 row in set (0.08 sec) mysql> select name from person where id = 2; +------+ | name | +------+ | R | +------+ 1 row in set (0.00 sec) mysql> insert int person (name) values("Karim"); 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 'int person (name) values("Karim")' at line 1 mysql> insert into person (name) values("Karim"); Query OK, 1 row affected (0.08 sec) mysql> insert into person (name) values("Salim"); Query OK, 1 row affected (0.07 sec) mysql> insert into person (name) values("Boxo"); Query OK, 1 row affected (0.06 sec) mysql> insert into person (name) values("Lola"); Query OK, 1 row affected (0.06 sec) mysql> insert into person (name) values("Hola"); Query OK, 1 row affected (0.06 sec) mysql> desc person; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(12) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 2 rows in set (0.01 sec) mysql> select * from person; +----+----------+ | id | name | +----+----------+ | 1 | Jahongir | | 2 | R | | 3 | Karim | | 4 | Salim | | 5 | Boxo | | 6 | Lola | | 7 | Hola | +----+----------+ 7 rows in set (0.00 sec) mysql> alter table person modify name varchar(20); Query OK, 7 rows affected (0.69 sec) Records: 7 Duplicates: 0 Warnings: 0 mysql> select * from person; +----+----------+ | id | name | +----+----------+ | 1 | Jahongir | | 2 | R | | 3 | Karim | | 4 | Salim | | 5 | Boxo | | 6 | Lola | | 7 | Hola | +----+----------+ 7 rows in set (0.00 sec) mysql> desc person; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(20) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 2 rows in set (0.01 sec) mysql> update person set name = "Lolaxon" were id = 6; 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 'were id = 6' at line 1 mysql> update person set name = "Lolaxon" where id = 6; Query OK, 1 row affected (0.08 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from person; +----+----------+ | id | name | +----+----------+ | 1 | Jahongir | | 2 | R | | 3 | Karim | | 4 | Salim | | 5 | Boxo | | 6 | Lolaxon | | 7 | Hola | +----+----------+ 7 rows in set (0.00 sec) mysql> delete from person where id = 6; Query OK, 1 row affected (0.11 sec) mysql> select * from person; +----+----------+ | id | name | +----+----------+ | 1 | Jahongir | | 2 | R | | 3 | Karim | | 4 | Salim | | 5 | Boxo | | 7 | Hola | +----+----------+ 6 rows in set (0.00 sec) Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.16 MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 tatu; Database changed mysql> show tables; +----------------+ | Tables_in_tatu | +----------------+ | person | | user | +----------------+ 2 rows in set (0.04 sec) mysql> create table talaba(id int Primary_key Auto_increment, io varchar(20), k_id integer); 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 'Primary_key Auto_increment, io varchar(20), k_id integer)' at line 1 mysql> create table talaba(id int Primary key auto_increment, io varchar(20), k_id integer); Query OK, 0 rows affected (0.67 sec) mysql> insert into talaba (fio) values("Ali"); ERROR 1054 (42S22): Unknown column 'fio' in 'field list' mysql> insert into talaba (io) values("Ali"); Query OK, 1 row affected (0.03 sec) mysql> insert into talaba (io) values("Vali"); Query OK, 1 row affected (0.06 sec) mysql> insert into talaba (io) values("Karim"); Query OK, 1 row affected (0.06 sec) mysql> insert into talaba (io) values("Salim"); Query OK, 1 row affected (0.08 sec) mysql> insert into talaba (io) values("Doni"); Query OK, 1 row affected (0.04 sec) mysql> create table kaf(id int Primary_key Auto_increment, name varchar(20)); 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 'Primary_key Auto_increment, name varchar(20))' at line 1 mysql> create table kaf(id int Primary key Auto_increment, name varchar(20)); Query OK, 0 rows affected (0.58 sec) mysql> desc talaba; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | io | varchar(20) | YES | | NULL | | | k_id | int(11) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) mysql> select * from talaba; +----+-------+------+ | id | io | k_id | +----+-------+------+ | 1 | Ali | NULL | | 2 | Vali | NULL | | 3 | Karim | NULL | | 4 | Salim | NULL | | 5 | Doni | NULL | +----+-------+------+ 5 rows in set (0.00 sec) mysql> select * from kaf; Empty set (0.00 sec) mysql> insert into kaf (name) values("AT"); Query OK, 1 row affected (0.06 sec) mysql> insert into kaf (name) values("KT"); Query OK, 1 row affected (0.06 sec) mysql> insert into kaf (name) values("ATDT"); Query OK, 1 row affected (0.07 sec) mysql> insert into kaf (name) values("Mt"); Query OK, 1 row affected (0.06 sec) mysql> select * from kaf; +----+------+ | id | name | +----+------+ | 1 | AT | | 2 | KT | | 3 | ATDT | | 4 | Mt | +----+------+ 4 rows in set (0.00 sec) mysql> select * from talaba; +----+-------+------+ | id | io | k_id | +----+-------+------+ | 1 | Ali | NULL | | 2 | Vali | NULL | | 3 | Karim | NULL | | 4 | Salim | NULL | | 5 | Doni | NULL | +----+-------+------+ 5 rows in set (0.00 sec) mysql> insert into kaf (name) values("BAT"); Query OK, 1 row affected (0.03 sec) mysql> select * from kaf; +----+------+ | id | name | +----+------+ | 1 | AT | | 2 | KT | | 3 | ATDT | | 4 | Mt | | 5 | BAT | +----+------+ 5 rows in set (0.00 sec) mysql> Alter table talaba modify k_id int auto inctrement; 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 'auto inctrement' at line 1 mysql> Alter table talaba modify k_id int auto_inctrement; 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 'auto_inctrement' at line 1 mysql> update table set k_id = 2 where id = 1; 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 'table set k_id = 2 where id = 1' at line 1 mysql> insert into talaba (io) values("Boxo"); Query OK, 1 row affected (0.07 sec) mysql> insert into talaba (io) values("Nodir"); Query OK, 1 row affected (0.06 sec) mysql> insert into talaba (io) values("Kamol"); Query OK, 1 row affected (0.07 sec) mysql> insert into talaba (io) values("Qudrat"); Query OK, 1 row affected (0.06 sec) mysql> insert into talaba (io) values("Johon"); Query OK, 1 row affected (0.06 sec) mysql> select * from talaba; +----+--------+------+ | id | io | k_id | +----+--------+------+ | 1 | Ali | NULL | | 2 | Vali | NULL | | 3 | Karim | NULL | | 4 | Salim | NULL | | 5 | Doni | NULL | | 6 | Boxo | NULL | | 7 | Nodir | NULL | | 8 | Kamol | NULL | | 9 | Qudrat | NULL | | 10 | Johon | NULL | +----+--------+------+ 10 rows in set (0.00 sec) mysql> insert into talaba (k_id) values(2); Query OK, 1 row affected (0.08 sec) mysql> select * from talaba; +----+--------+------+ | id | io | k_id | +----+--------+------+ | 1 | Ali | NULL | | 2 | Vali | NULL | | 3 | Karim | NULL | | 4 | Salim | NULL | | 5 | Doni | NULL | | 6 | Boxo | NULL | | 7 | Nodir | NULL | | 8 | Kamol | NULL | | 9 | Qudrat | NULL | | 10 | Johon | NULL | | 11 | NULL | 2 | +----+--------+------+ 11 rows in set (0.00 sec) mysql> delete from talaba where k_id = 2; Query OK, 1 row affected (0.09 sec) mysql> select * from talaba; +----+--------+------+ | id | io | k_id | +----+--------+------+ | 1 | Ali | NULL | | 2 | Vali | NULL | | 3 | Karim | NULL | | 4 | Salim | NULL | | 5 | Doni | NULL | | 6 | Boxo | NULL | | 7 | Nodir | NULL | | 8 | Kamol | NULL | | 9 | Qudrat | NULL | | 10 | Johon | NULL | +----+--------+------+ 10 rows in set (0.00 sec) mysql> update table set k_id = 2 where id = 1; 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 'table set k_id = 2 where id = 1' at line 1 mysql> desc talaba; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | io | varchar(20) | YES | | NULL | | | k_id | int(11) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) mysql> insert into talaba (k_id) values(2) where id = 1; 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 'where id = 1' at line 1 mysql> update table set k_id = 2 where id = 1; 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 'table set k_id = 2 where id = 1' at line 1 mysql> select * from talaba; +----+--------+------+ | id | io | k_id | +----+--------+------+ | 1 | Ali | NULL | | 2 | Vali | NULL | | 3 | Karim | NULL | | 4 | Salim | NULL | | 5 | Doni | NULL | | 6 | Boxo | NULL | | 7 | Nodir | NULL | | 8 | Kamol | NULL | | 9 | Qudrat | NULL | | 10 | Johon | NULL | +----+--------+------+ 10 rows in set (0.00 sec) mysql> update table set k_id = 2 where id = 1; 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 'table set k_id = 2 where id = 1' at line 1 mysql> desc talaba; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | io | varchar(20) | YES | | NULL | | | k_id | int(11) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 3 rows in set (0.01 sec) mysql> update talaba set k_id = 2 where id = 1; Query OK, 1 row affected (0.10 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 4 where id = 2; Query OK, 1 row affected (0.08 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 3 where id = 3; Query OK, 1 row affected (0.09 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 1 where id = 4; Query OK, 1 row affected (0.06 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 5 where id = 4; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 5 where id = 5; Query OK, 1 row affected (0.08 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 4 where id = 6; Query OK, 1 row affected (0.07 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 2 where id = 7; Query OK, 1 row affected (0.07 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 1 where id = 8; Query OK, 1 row affected (0.07 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 4 where id = 9; Query OK, 1 row affected (0.09 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set k_id = 3 where id = 10; Query OK, 1 row affected (0.05 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> join kaf on talaba.k_id = kaf.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 'join kaf on talaba.k_id = kaf.id' at line 1 mysql> select * from talaba join kaf on talaba.k_id = kaf.id; +----+--------+------+----+------+ | id | io | k_id | id | name | +----+--------+------+----+------+ | 8 | Kamol | 1 | 1 | AT | | 1 | Ali | 2 | 2 | KT | | 7 | Nodir | 2 | 2 | KT | | 3 | Karim | 3 | 3 | ATDT | | 10 | Johon | 3 | 3 | ATDT | | 2 | Vali | 4 | 4 | Mt | | 6 | Boxo | 4 | 4 | Mt | | 9 | Qudrat | 4 | 4 | Mt | | 4 | Salim | 5 | 5 | BAT | | 5 | Doni | 5 | 5 | BAT | +----+--------+------+----+------+ 10 rows in set (0.04 sec) mysql> select talaba.io,kaf.name from talaba join kaf on talaba.k_id = kaf.id; +--------+------+ | io | name | +--------+------+ | Kamol | AT | | Ali | KT | | Nodir | KT | | Karim | ATDT | | Johon | ATDT | | Vali | Mt | | Boxo | Mt | | Qudrat | Mt | | Salim | BAT | | Doni | BAT | +--------+------+ 10 rows in set (0.00 sec) mysql> select talaba.io,kaf.name from as t join kaf on talaba.k_id = kaf.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 'as t join kaf on talaba.k_id = kaf.id' at line 1 mysql> select talaba.io,kaf.name from talaba as t join kaf on t.k_id = kaf.id; ERROR 1054 (42S22): Unknown column 'talaba.io' in 'field list' mysql> select talaba.io,kaf.name from t join kaf on t.k_id = kaf.id; ERROR 1146 (42S02): Table 'tatu.t' doesn't exist mysql> select talaba.io,kaf.name from talaba t join kaf on t.k_id = kaf.id; ERROR 1054 (42S22): Unknown column 'talaba.io' in 'field list' mysql> selesct io from talaba; 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 'selesct io from talaba' at line 1 mysql> select io from talaba; +--------+ | io | +--------+ | Ali | | Vali | | Karim | | Salim | | Doni | | Boxo | | Nodir | | Kamol | | Qudrat | | Johon | +--------+ 10 rows in set (0.00 sec) mysql> select io familya from talaba; +---------+ | familya | +---------+ | Ali | | Vali | | Karim | | Salim | | Doni | | Boxo | | Nodir | | Kamol | | Qudrat | | Johon | +---------+ 10 rows in set (0.00 sec) mysql> select io as familya from talaba; +---------+ | familya | +---------+ | Ali | | Vali | | Karim | | Salim | | Doni | | Boxo | | Nodir | | Kamol | | Qudrat | | Johon | +---------+ 10 rows in set (0.00 sec) mysql> select id,io from talaba union select id,nomi from kaf; ERROR 1054 (42S22): Unknown column 'nomi' in 'field list' mysql> select talaba.id,talaba.io from talaba union select ka.id,kaf.nomi from kaf; ERROR 1054 (42S22): Unknown column 'ka.id' in 'field list' mysql> select talaba.id,talaba.io from talaba union select kaf.id,kaf.nomi from kaf; ERROR 1054 (42S22): Unknown column 'kaf.nomi' in 'field list' mysql> select talaba.id,talaba.io from talaba union select kaf.id,kaf.name from kaf; +----+--------+ | id | io | +----+--------+ | 1 | Ali | | 2 | Vali | | 3 | Karim | | 4 | Salim | | 5 | Doni | | 6 | Boxo | | 7 | Nodir | | 8 | Kamol | | 9 | Qudrat | | 10 | Johon | | 1 | AT | | 2 | KT | | 3 | ATDT | | 4 | Mt | | 5 | BAT | +----+--------+ 15 rows in set (0.00 sec) mysql> select talaba.k_id from talaba insersect select kaf.id from faf; 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 kaf.id from faf' at line 1 mysql> select talaba.k_id from talaba insersect select kaf.id from kaf; 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 kaf.id from kaf' at line 1 mysql> select talaba.k_id from talaba insersect select id from kaf; 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 id from kaf' at line 1 mysql> select k_id from talaba insersect select id from kaf; 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 id from kaf' at line 1 mysql> select talaba.k_id from talaba insersect select kaf.id from kaf; 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 kaf.id from kaf' at line 1 mysql> select talaba.k_id from talaba join select kaf.id from kaf; 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 kaf.id from kaf' at line 1 mysql> select talaba.k_id from talaba inner join select kaf.id from kaf; 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 kaf.id from kaf' at line 1 mysql> select talaba.k_id from talaba join on select kaf.id from kaf; 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 'on select kaf.id from kaf' at line 1 mysql> select talaba.io,kaf.name from t join kaf on t.k_id = kaf.id; ERROR 1146 (42S02): Table 'tatu.t' doesn't exist mysql> select * from talaba join kaf on talaba.k_id = kaf.id; +----+--------+------+----+------+ | id | io | k_id | id | name | +----+--------+------+----+------+ | 8 | Kamol | 1 | 1 | AT | | 1 | Ali | 2 | 2 | KT | | 7 | Nodir | 2 | 2 | KT | | 3 | Karim | 3 | 3 | ATDT | | 10 | Johon | 3 | 3 | ATDT | | 2 | Vali | 4 | 4 | Mt | | 6 | Boxo | 4 | 4 | Mt | | 9 | Qudrat | 4 | 4 | Mt | | 4 | Salim | 5 | 5 | BAT | | 5 | Doni | 5 | 5 | BAT | +----+--------+------+----+------+ 10 rows in set (0.01 sec) Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.16 MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 tatu; Database changed mysql> select * from talaba; +----+--------+------+ | id | io | k_id | +----+--------+------+ | 1 | Ali | 2 | | 2 | Vali | 4 | | 3 | Karim | 3 | | 4 | Salim | 5 | | 5 | Doni | 5 | | 6 | Boxo | 4 | | 7 | Nodir | 2 | | 8 | Kamol | 1 | | 9 | Qudrat | 4 | | 10 | Johon | 3 | +----+--------+------+ 10 rows in set (0.00 sec) mysql> select * from person; +----+----------+ | id | name | +----+----------+ | 1 | Jahongir | | 2 | R | | 3 | Karim | | 4 | Salim | | 5 | Boxo | | 7 | Hola | +----+----------+ 6 rows in set (0.03 sec) mysql> show tables; +----------------+ | Tables_in_tatu | +----------------+ | kaf | | person | | talaba | | user | +----------------+ 4 rows in set (0.00 sec) mysql> select * from user; Empty set (0.04 sec) mysql> drop table kaf; Query OK, 0 rows affected (0.19 sec) mysql> drop table person; Query OK, 0 rows affected (0.08 sec) mysql> drop table talaba; Query OK, 0 rows affected (0.09 sec) mysql> drop table user; Query OK, 0 rows affected (0.14 sec) mysql> show tables; Empty set (0.00 sec) mysql> create table talaba(id int primary key auto_incrament, name varchar(20), age int, address varchar(10)); 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 'auto_incrament, name varchar(20), age int, address varchar(10))' at line 1 mysql> create table talaba(id int primary key auto_increment, name varchar(20), age int, address varchar(10)); Query OK, 0 rows affected (0.28 sec) mysql> insert into talaba (name,age,address) values("Jahongir"),values(19),values("Tashkent"); 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 'values(19),values("Tashkent")' at line 1 mysql> insert into talaba (name,age,address) (values("Jahongir"),values(19),values("Tashkent")); 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 'values("Jahongir"),values(19),values("Tashkent"))' at line 1 mysql> insert into talaba (name,age,address) values("Jahongir",19,"Tashkent"); Query OK, 1 row affected (0.03 sec) mysql> insert into talaba (name,age,address) values("Javoxir",17,"Tashkent"); Query OK, 1 row affected (0.03 sec) mysql> insert into talaba (name,age,address) values("Farhod",21,"Fargana"); Query OK, 1 row affected (0.03 sec) mysql> insert into talaba (name,age,address) values("Ali",25,"Xorazm"); Query OK, 1 row affected (0.02 sec) mysql> insert into talaba (name,age,address) values("Vali",30,"Buxoro"); Query OK, 1 row affected (0.03 sec) mysql> insert into talaba (name,age,address) values("G'ani",15,"Samarqand"); Query OK, 1 row affected (0.03 sec) mysql> insert into talaba (name,age,address) values("G'ulom",10,"Sirdaryo"); Query OK, 1 row affected (0.03 sec) mysql> selext * from talaba where age = 17 and address like("T%"); 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 'selext * from talaba where age = 17 and address like("T%")' at line 1 mysql> select * from talaba where age = 17 and address like("T%"); +----+---------+------+----------+ | id | name | age | address | +----+---------+------+----------+ | 2 | Javoxir | 17 | Tashkent | +----+---------+------+----------+ 1 row in set (0.04 sec) mysql> select * from talaba where age = 17 or address like("T%"); +----+----------+------+----------+ | id | name | age | address | +----+----------+------+----------+ | 1 | Jahongir | 19 | Tashkent | | 2 | Javoxir | 17 | Tashkent | +----+----------+------+----------+ 2 rows in set (0.00 sec) mysql> select * from talaba where age between 12 and 20; +----+----------+------+-----------+ | id | name | age | address | +----+----------+------+-----------+ | 1 | Jahongir | 19 | Tashkent | | 2 | Javoxir | 17 | Tashkent | | 6 | G'ani | 15 | Samarqand | +----+----------+------+-----------+ 3 rows in set (0.01 sec) mysql> select * from talaba where age between 10 and 30; +----+----------+------+-----------+ | id | name | age | address | +----+----------+------+-----------+ | 1 | Jahongir | 19 | Tashkent | | 2 | Javoxir | 17 | Tashkent | | 3 | Farhod | 21 | Fargana | | 4 | Ali | 25 | Xorazm | | 5 | Vali | 30 | Buxoro | | 6 | G'ani | 15 | Samarqand | | 7 | G'ulom | 10 | Sirdaryo | +----+----------+------+-----------+ 7 rows in set (0.00 sec) mysql> select * from talaba where age isNull; 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 'isNull' at line 1 mysql> select * from talaba where age isnull; 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 'isnull' at line 1 mysql> select * from talaba where age(isnull); ERROR 1305 (42000): FUNCTION tatu.age does not exist mysql> select * from talaba where isnull(age); Empty set (0.01 sec) mysql> select * from talaba where !isnull(age); +----+----------+------+-----------+ | id | name | age | address | +----+----------+------+-----------+ | 1 | Jahongir | 19 | Tashkent | | 2 | Javoxir | 17 | Tashkent | | 3 | Farhod | 21 | Fargana | | 4 | Ali | 25 | Xorazm | | 5 | Vali | 30 | Buxoro | | 6 | G'ani | 15 | Samarqand | | 7 | G'ulom | 10 | Sirdaryo | +----+----------+------+-----------+ 7 rows in set (0.00 sec) mysql> create table groups(id int primary key auto_increment, name varchar(20) , coach varchar(20)); Query OK, 0 rows affected (0.25 sec) mysql> alter table talaba add group varchar(10); 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 'group varchar(10)' at line 1 mysql> alter table talaba add(group varchar(10)); 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 'group varchar(10))' at line 1 mysql> alter table talaba ADD group varchar(10); 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 'group varchar(10)' at line 1 mysql> alter table talaba ADD group varchar; 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 'group varchar' at line 1 mysql> alter table talaba ADD (group) varchar(5); 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 'group) varchar(5)' at line 1 mysql> alter table talaba ADD (group) varchar(5)); 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 'group) varchar(5))' at line 1 mysql> alter table talaba modify ADD group varchar(5); 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 'ADD group varchar(5)' at line 1 mysql> alter table talaba modify ADD grouppa varchar(5); 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 'ADD grouppa varchar(5)' at line 1 mysql> alter table talaba ADD grouppa varchar(5); Query OK, 0 rows affected (0.49 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> desc talaba; +---------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(20) | YES | | NULL | | | age | int(11) | YES | | NULL | | | address | varchar(10) | YES | | NULL | | | grouppa | varchar(5) | YES | | NULL | | +---------+-------------+------+-----+---------+----------------+ 5 rows in set (0.04 sec) mysql> update table talaba set grouppa = "210-18" where id = 1; 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 'table talaba set grouppa = "210-18" where id = 1' at line 1 mysql> update talaba set grouppa = "210-18" where id = 1; ERROR 1406 (22001): Data too long for column 'grouppa' at row 1 mysql> update talaba set grouppa = "210" where id = 1; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set grouppa = "211" where id = 2; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set grouppa = "212" where id = 3; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set grouppa = "211" where id = 4; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set grouppa = "210" where id = 5; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from talaba; +----+----------+------+-----------+---------+ | id | name | age | address | grouppa | +----+----------+------+-----------+---------+ | 1 | Jahongir | 19 | Tashkent | 210 | | 2 | Javoxir | 17 | Tashkent | 211 | | 3 | Farhod | 21 | Fargana | 212 | | 4 | Ali | 25 | Xorazm | 211 | | 5 | Vali | 30 | Buxoro | 210 | | 6 | G'ani | 15 | Samarqand | NULL | | 7 | G'ulom | 10 | Sirdaryo | NULL | +----+----------+------+-----------+---------+ 7 rows in set (0.00 sec) mysql> update talaba set grouppa = "213" where id = 6; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update talaba set grouppa = "212" where id = 7; Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from talaba; +----+----------+------+-----------+---------+ | id | name | age | address | grouppa | +----+----------+------+-----------+---------+ | 1 | Jahongir | 19 | Tashkent | 210 | | 2 | Javoxir | 17 | Tashkent | 211 | | 3 | Farhod | 21 | Fargana | 212 | | 4 | Ali | 25 | Xorazm | 211 | | 5 | Vali | 30 | Buxoro | 210 | | 6 | G'ani | 15 | Samarqand | 213 | | 7 | G'ulom | 10 | Sirdaryo | 212 | +----+----------+------+-----------+---------+ 7 rows in set (0.00 sec) mysql> desc group; 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 'group' at line 1 mysql> show tables -> show tables; 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 'show tables' at line 2 mysql> show tables; +----------------+ | Tables_in_tatu | +----------------+ | groups | | talaba | +----------------+ 2 rows in set (0.00 sec) mysql> desc groups; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(20) | YES | | NULL | | | coach | varchar(20) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) mysql> insert into groups (name,coach) values("210","Dilfuza"); Query OK, 1 row affected (0.04 sec) mysql> insert into groups (name,coach) values("211","Feruza"); Query OK, 1 row affected (0.03 sec) mysql> insert into groups (name,coach) values("212","Bahodir"); Query OK, 1 row affected (0.04 sec) mysql> insert into groups (name,coach) values("213","Aziza"); Query OK, 1 row affected (0.02 sec) mysql> select talaba.name, talaba.grouppa, groups.coach from talaba join groups on talaba.gruppa = groups.name; ERROR 1054 (42S22): Unknown column 'talaba.gruppa' in 'on clause' mysql> select talaba.name, talaba.grouppa, groups.coach from talaba join groups on talaba.grouppa = groups.name; +----------+---------+---------+ | name | grouppa | coach | +----------+---------+---------+ | Jahongir | 210 | Dilfuza | | Javoxir | 211 | Feruza | | Farhod | 212 | Bahodir | | Ali | 211 | Feruza | | Vali | 210 | Dilfuza | | G'ani | 213 | Aziza | | G'ulom | 212 | Bahodir | +----------+---------+---------+ 7 rows in set (0.01 sec) mysql> select talaba.name, talaba.grouppa, groups.coach from talaba join groups on talaba.grouppa = groups.name and groups.name = "210"; +----------+---------+---------+ | name | grouppa | coach | +----------+---------+---------+ | Jahongir | 210 | Dilfuza | | Vali | 210 | Dilfuza | +----------+---------+---------+ 2 rows in set (0.00 sec) mysql>
Download 35.01 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling