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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
| mysql> desc titles; +-----------+---------------+------+-----+-----------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------+------+-----+-----------+-------+ | title_id | varchar(6) | NO | PRI | NULL | | | title | varchar(80) | NO | MUL | NULL | | | type | varchar(12) | NO | | UNDECIDED | | | pub_id | varchar(4) | YES | | NULL | | | price | decimal(19,4) | YES | | NULL | | | advance | decimal(19,4) | YES | | NULL | | | royalty | int(11) | YES | | NULL | | | ytd_sales | int(11) | YES | | NULL | | | notes | varchar(200) | YES | | NULL | | | pubdate | datetime | NO | | NULL | | +-----------+---------------+------+-----+-----------+-------+ 10 rows in set (0.00 sec)
mysql> desc titleauthor; +------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------------+------+-----+---------+-------+ | au_id | varchar(11) | NO | PRI | NULL | | | title_id | varchar(6) | NO | PRI | NULL | | | au_ord | tinyint(3) unsigned | YES | | NULL | | | royaltyper | int(11) | YES | | NULL | | +------------+---------------------+------+-----+---------+-------+ 4 rows in set (0.00 sec)
mysql> desc authors; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | au_id | varchar(11) | NO | PRI | NULL | | | au_lname | varchar(40) | NO | MUL | NULL | | | au_fname | varchar(20) | NO | | NULL | | | phone | varchar(12) | NO | | UNKNOWN | | | address | varchar(40) | YES | | NULL | | | city | varchar(20) | YES | | NULL | | | state | varchar(2) | YES | | NULL | | | zip | varchar(5) | YES | | NULL | | | contract | bit(1) | NO | | NULL | | +----------+-------------+------+-----+---------+-------+ 9 rows in set (0.00 sec)
mysql> select title,au_ord from titles inner join titleauthor on titles.title_id=titleauthor.title_id; +-----------------------------------------------------------------+--------+ | title | au_ord | +-----------------------------------------------------------------+--------+ | But Is It User Friendly? | 1 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 2 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 1 | | Cooking with Computers: Surreptitious Balance Sheets | 2 | | Cooking with Computers: Surreptitious Balance Sheets | 1 | | Emotional Security: A New Algorithm | 1 | | Fifty Years in Buckingham Palace Kitchens | 1 | | Is Anger the Enemy? | 2 | | Is Anger the Enemy? | 1 | | Life Without Fear | 1 | | Net Etiquette | 1 | | Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean | 1 | | Prolonged Data Deprivation: Four Case Studies | 1 | | Secrets of Silicon Valley | 1 | | Secrets of Silicon Valley | 2 | | Silicon Valley Gastronomic Treats | 1 | | Straight Talk About Computers | 1 | | Sushi, Anyone? | 2 | | Sushi, Anyone? | 3 | | Sushi, Anyone? | 1 | | The Busy Executive's Database Guide | 2 | | The Busy Executive's Database Guide | 1 | | The Gourmet Microwave | 1 | | The Gourmet Microwave | 2 | | You Can Combat Computer Stress! | 1 | +-----------------------------------------------------------------+--------+ 25 rows in set (0.00 sec)
mysql> select title,au_ord from titles inner join titleauthor on titles.title_id=titleauthor.title_id inner join authors on authors.au_id=titleauthor.au_id; +-----------------------------------------------------------------+--------+ | title | au_ord | +-----------------------------------------------------------------+--------+ | But Is It User Friendly? | 1 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 2 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 1 | | Cooking with Computers: Surreptitious Balance Sheets | 2 | | Cooking with Computers: Surreptitious Balance Sheets | 1 | | Emotional Security: A New Algorithm | 1 | | Fifty Years in Buckingham Palace Kitchens | 1 | | Is Anger the Enemy? | 2 | | Is Anger the Enemy? | 1 | | Life Without Fear | 1 | | Net Etiquette | 1 | | Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean | 1 | | Prolonged Data Deprivation: Four Case Studies | 1 | | Secrets of Silicon Valley | 1 | | Secrets of Silicon Valley | 2 | | Silicon Valley Gastronomic Treats | 1 | | Straight Talk About Computers | 1 | | Sushi, Anyone? | 2 | | Sushi, Anyone? | 3 | | Sushi, Anyone? | 1 | | The Busy Executive's Database Guide | 2 | | The Busy Executive's Database Guide | 1 | | The Gourmet Microwave | 1 | | The Gourmet Microwave | 2 | | You Can Combat Computer Stress! | 1 | +-----------------------------------------------------------------+--------+ 25 rows in set (0.00 sec)
mysql> select title,au_ord from titles left join titleauthor on titles.title_id=titleauthor.title_id; +-----------------------------------------------------------------+--------+ | title | au_ord | +-----------------------------------------------------------------+--------+ | But Is It User Friendly? | 1 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 2 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 1 | | Cooking with Computers: Surreptitious Balance Sheets | 2 | | Cooking with Computers: Surreptitious Balance Sheets | 1 | | Emotional Security: A New Algorithm | 1 | | Fifty Years in Buckingham Palace Kitchens | 1 | | Is Anger the Enemy? | 2 | | Is Anger the Enemy? | 1 | | Life Without Fear | 1 | | Net Etiquette | 1 | | Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean | 1 | | Prolonged Data Deprivation: Four Case Studies | 1 | | Secrets of Silicon Valley | 1 | | Secrets of Silicon Valley | 2 | | Silicon Valley Gastronomic Treats | 1 | | Straight Talk About Computers | 1 | | Sushi, Anyone? | 2 | | Sushi, Anyone? | 3 | | Sushi, Anyone? | 1 | | The Busy Executive's Database Guide | 2 | | The Busy Executive's Database Guide | 1 | | The Gourmet Microwave | 1 | | The Gourmet Microwave | 2 | | The Psychology of Computer Cooking | NULL | | You Can Combat Computer Stress! | 1 | +-----------------------------------------------------------------+--------+ 26 rows in set (0.00 sec)
mysql> select title,au_ord from titles right join titleauthor on titles.title_id=titleauthor.title_id; +-----------------------------------------------------------------+--------+ | title | au_ord | +-----------------------------------------------------------------+--------+ | Prolonged Data Deprivation: Four Case Studies | 1 | | The Busy Executive's Database Guide | 2 | | You Can Combat Computer Stress! | 1 | | But Is It User Friendly? | 1 | | Cooking with Computers: Surreptitious Balance Sheets | 2 | | Sushi, Anyone? | 2 | | Straight Talk About Computers | 1 | | The Busy Executive's Database Guide | 1 | | Secrets of Silicon Valley | 1 | | Sushi, Anyone? | 3 | | Net Etiquette | 1 | | Emotional Security: A New Algorithm | 1 | | Fifty Years in Buckingham Palace Kitchens | 1 | | Sushi, Anyone? | 1 | | Silicon Valley Gastronomic Treats | 1 | | The Gourmet Microwave | 1 | | Cooking with Computers: Surreptitious Balance Sheets | 1 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 2 | | Computer Phobic AND Non-Phobic Individuals: Behavior Variations | 1 | | Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean | 1 | | Secrets of Silicon Valley | 2 | | The Gourmet Microwave | 2 | | Is Anger the Enemy? | 2 | | Is Anger the Enemy? | 1 | | Life Without Fear | 1 | +-----------------------------------------------------------------+--------+ 25 rows in set (0.00 sec)
|