Professional Documents
Culture Documents
Mysql Record
Mysql Record
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter table city constraint "primary key violation" add primary key (name);
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
'constraint "primary key violation" add primary key (name)' at line 1
mysql> alter table city constraint "primary key violation" add primary key(name);
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
'constraint "primary key violation" add primary key(name)' at line 1
mysql> alter table city add primary key(name);
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table city constraint "primary key violation" add primary key(name);
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
'constraint "primary key violation" add primary key(name)' at line 1
mysql> alter table city modify primary key(name) primary key(pincode);
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(name) primary key(pincode)' at line 1
mysql> desc city
-> ;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(30) | NO | PRI | NULL | |
| pincode | varchar(6) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter table customer drop primary key, add primary key(customer_id);
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select
orders.ord_no,customer.cust_name,orders.customer_id,orders.salesman_id from orders,
customer, salesman where customer.salesman_id=orders.salesman_id and not
customer.city = salesman.city;
+--------+----------------+-------------+-------------+
| ord_no | cust_name | customer_id | salesman_id |
+--------+----------------+-------------+-------------+
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
+--------+----------------+-------------+-------------+
100 rows in set (0.00 sec)
mysql> select
orders.ord_no,customer.cust_name,orders.customer_id,orders.salesman_id from orders,
customer, salesman where customer.salesman_id=orders.salesman_id and
customer.city != salesman.city;
+--------+----------------+-------------+-------------+
| ord_no | cust_name | customer_id | salesman_id |
+--------+----------------+-------------+-------------+
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70009 | Brad Guzan | 3001 | 5005 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70002 | Nick Rimando | 3002 | 5001 |
| 70005 | Nick Rimando | 3007 | 5001 |
| 70008 | Nick Rimando | 3002 | 5001 |
| 70013 | Nick Rimando | 3002 | 5001 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70011 | Jozy Altidor | 3003 | 5007 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70010 | Fabian Johnson | 3004 | 5006 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Graham Zusi | 3008 | 5002 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70002 | Brav Davis | 3002 | 5001 |
| 70005 | Brav Davis | 3007 | 5001 |
| 70008 | Brav Davis | 3002 | 5001 |
| 70013 | Brav Davis | 3002 | 5001 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70001 | Julian Green | 3005 | 5002 |
| 70007 | Julian Green | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
+--------+----------------+-------------+-------------+
100 rows in set (0.00 sec)
mysql> select
orders.ord_no,customer.cust_name,orders.customer_id,orders.salesman_id from orders,
customer, salesman where customer.customer_id=orders.customer_id and
customer.city != salesman.city and customer.salesman_id=salesman.salesman_id;
+--------+---------------+-------------+-------------+
| ord_no | cust_name | customer_id | salesman_id |
+--------+---------------+-------------+-------------+
| 70001 | Graham Zusi | 3005 | 5002 |
| 70007 | Graham Zusi | 3005 | 5002 |
| 70012 | Julian Green | 3008 | 5002 |
| 70003 | Geoff Cameron | 3009 | 5003 |
| 70004 | Geoff Cameron | 3009 | 5003 |
| 70011 | Jozy Altidor | 3003 | 5007 |
+--------+---------------+-------------+-------------+
6 rows in set (0.00 sec)
mysql>