CREATE TABLE Manufacturers
(
ManfID CHAR(8) NOT NULL PRIMARY KEY,
ManfName VARCHAR(30) NOT NULL
)
ENGINE=INNODB;
INSERT INTO Manufacturers
VALUES ("abc123", "ABCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"),
("def456", "DEFwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"),
("ghi789", "GHIeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"),
("jkl123", "JKLrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"),
("mno456", "MNOttttttttttttttttttttttttttttttttttttttttttttttttttttttt");
CREATE TABLE Parts
(
PartID SMALLINT NOT NULL PRIMARY KEY,
PartName VARCHAR(30) NOT NULL,
ManfID CHAR(8) NOT NULL
)
ENGINE=INNODB;
INSERT INTO Parts
VALUES (101, "DVD burnerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "abc123"),
(102, "CD driveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "jkl123"),
(103, "80-GB hard diskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", "mno456"),
(104, "Mini-towerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "ghi789"),
(105, "Power supplyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", "def456"),
(106, "LCD monitorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "mno456"),
(107, "Zip driveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "ghi789"),
(108, "Floppy driveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "jkl123"),
(109, "Network adapterrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "def456"),
(110, "Network hubbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "jkl123"),
(111, "Routerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "mno456"),
(112, "Sound cardddddddddddddddddddddddddddddddddddd", "ghi789"),
(113, "Standard keyboarddddddddddddddddddddddddddddd", "mno456"),
(114, "PS/2 mouseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "jkl123"),
(115, "56-K modemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "ghi789"),
(116, "Display adapterrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "mno456"),
(117, "IDE controllerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr", "def456");
SELECT PartName, ManfName
FROM Parts AS p, Manufacturers as m
WHERE p.ManfID = m.ManfID
ORDER BY PartName;
EXPLAIN SELECT PartName, ManfName
FROM Parts AS p, Manufacturers as m
WHERE p.ManfID = m.ManfID
ORDER BY PartName;