mysql CREATE DATABASE IF NOT EXISTS test mysql CREATE TABLE city0 ENGI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
mysql> CREATE DATABASE IF NOT EXISTS test;
mysql> CREATE TABLE city0 ENGINE=InnoDB SELECT * FROM world.city;
mysql> SELECT COUNT(*)
-> FROM city0 c1
-> WHERE EXISTS (SELECT * FROM city0 c2 WHERE c2.Name = c1.Name);
mysql> EXPLAIN
-> SELECT COUNT(*)
-> FROM city0 c1
-> WHERE EXISTS (SELECT * FROM city0 c2 WHERE c1.name = c2.name)
-> \G
mysql> CREATE TABLE city1 ENGINE=InnoDB SELECT * FROM world.city;
mysql> CREATE INDEX ixName ON city1 (name);
mysql> SELECT COUNT(*)
-> FROM city1 c1
-> WHERE EXISTS (SELECT * FROM city1 c2 WHERE c1.name = c2.name);
mysql> EXPLAIN
-> SELECT COUNT(*)
-> FROM city1 c1
-> WHERE EXISTS (SELECT * FROM city1 c2 WHERE c2.name = c1.name)
-> \G
mysql> CREATE TABLE city2 ENGINE=MyISAM SELECT * FROM world.city;
mysql> CREATE INDEX ixID ON city2 (ID);
mysql> CREATE INDEX ixName ON city2 (name);
mysql> CREATE INDEX ixCountryCode ON city2 (CountryCode);
mysql> CREATE INDEX ixDistrict ON city2 (District);
mysql> CREATE INDEX ixPopulation ON city2 (Population);
mysql> EXPLAIN
-> SELECT COUNT(*)
-> FROM city2 c1
-> WHERE EXISTS (SELECT * FROM city2 c2 WHERE c1.name = c2.name)
-> \G
C:\>mysql -uroot -p bookshop -e "SET NAMES utf8; SELECT title FROM books" -X > c:/test.xml
mysql> SHOW VARIABLES LIKE 'query_cache%';