Section 1: _________ Start, All programs, WampServer, Start WampServer C:\>cd wamp/mysql/bin C:\wamp\mysql\bin>Mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.15-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create table tblCTCustomer ( -> fldCTCustomerId int(4) not null, -> primary key (fldCTCustomerId)); Query OK, 0 rows affected (0.05 sec) mysql> alter table tblCTCustomer add (fldCTFamilyName varchar(50)); Query OK, 0 rows affected (0.09 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer modify fldCTFamilyName varchar(30); Query OK, 0 rows affected (0.19 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTGivenName varchar(30)); Query OK, 0 rows affected (0.09 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTAddress varchar(50)); Query OK, 0 rows affected (0.08 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTCity varchar(40)); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTState char(3)); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTPostCode char(4)); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTPhone char(10)); Query OK, 0 rows affected (0.08 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTCustomer add (fldCTJoinDate date); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 _______________________________ mysql> create table tblCTInvoice ( -> fldCTInvoiceId int(4) not null, -> primary key (fldCTInvoiceId)); Query OK, 0 rows affected (0.09 sec) mysql> alter table tblCTInvoice add (fldCTCustomerId int(4)); Query OK, 0 rows affected (0.09 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTInvoice add (fldCTinvoiceDate date); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 _____________________________________ mysql> create table tblCTInvoiceLine( -> fldCTInvoiceId int(4) not null, -> fldCTStockId int(4) not null, -> primary key (fldCTInvoiceId, fldCTStockId)); Query OK, 0 rows affected (0.09 sec) mysql> alter table tblCTInvoiceLine add (fldCTQuantity int(2)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTInvoiceLine add (fldCTPrice decimal(8,2)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTInvoiceLine add (fldCTTax decimal(8,2)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 _______________________________ mysql> create table tblCTStock( -> fldStockId int(4) not null, -> primary key (fldStockId)); Query OK, 0 rows affected (0.03 sec) mysql> alter table tblCTStock add (fldCTDescription varchar(50)); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTStock add (fldCTManId varchar(15)); Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTStock add (fldCTCost decimal(8)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTStock add (fldCTTaxRate float(4)); Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTStock add (fldCTSupplierId int(4)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 __________________________________ mysql> create table tblCTSupplier( -> fldCTSupplierId int(4) not null, -> primary key (fldCTSupplierId)); Query OK, 0 rows affected (0.03 sec) mysql> alter table tblCTSupplier add (fldCTSupplierName varchar(50)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTSupplier add (fldCTAddress varchar(50)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTSupplier add (fldCTCity varchar(40)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTSupplier add (fldCTState varchar(3)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTSupplier add (fldCTPostCode varchar(4)); Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table tblCTSupplier add (fldCTPhone varchar(10)); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 ____________________________________ mysql> insert into tblCTInvoice -> values(1,'13','2004/08/01'); Query OK, 1 row affected (0.03 sec) mysql> insert into tblCTInvoice -> values(2,'13','2004/07/13'); Query OK, 1 row affected (0.03 sec) mysql> insert into tblCTInvoice -> values(3,'14','2004/08/02'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoice -> values(4,'14','2004/08/10'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoice -> values(5,'15','2004/08/10'); Query OK, 1 row affected (0.00 sec) ___________________________________ mysql> insert into tblCTInvoiceLine -> values(1,'2','1','100','10'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(1,'3','2','75','7.50'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(1,'4','1','190','19'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(2,'1','2','100','10'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(2,'6','2','35','3.50'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(2,'7','1','35','3.50'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(2,'11','1','125','12.50'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(3,'12','1','3500','350'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(4,'1','1','100','10'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTInvoiceLine -> values(4,'3','2','75','7.50'); Query OK, 1 row affected (0.00 sec) _________________________ mysql> insert into tblCTStock -> values(1,'Fuel pump','VFP12346','100','0.1','4'); Query OK, 1 row affected (0.22 sec) mysql> insert into tblCTStock -> values(2,'Fuel pump','VFP12347','125','0.1','4'); Query OK, 1 row affected (0.02 sec) mysql> insert into tblCTStock -> values(3,'Coil','VFP12349','75','0.1','4'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(4,'Radiator Core','VFP12334','190','0.1','4'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(5,'Radiator top tank','FMC12345','150','0.1','2'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(6,'Heater core','AAC4567894','35','0.1','8'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(7,'Oil pressure sensor','MA4567890','35','0.1','6'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(8,'LSD complete','MBA12345','1500','0.1','5'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(9,'Windscreen','GMH12890','700','0.1','1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(10,'Windscreen','GMH12891','550','0.1','1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(11,'Fuel pump','GMH12347','125','0.1','1'); Query OK, 1 row affected (0.02 sec) mysql> insert into tblCTStock -> values(12,'Gearbox complete','GMH54321','3500','0.1','1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(13,'Gearbox complete','GMH54325','5500','0.1','1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(14,'Gearbox complete','FMC54321','3500','0.1','2'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTStock -> values(15,'LSD complete','FMC54324','1500','0.1','2'); Query OK, 1 row affected (0.00 sec) select fldGivenName, fldFamilyName from tblMember; This example displays columns fldGivenName and fldFamilyName for all of the rows in the table. mysql> insert into tblCTCustomer -> values(13,'McCormack','Bob','121 Stud Rd','Dandenong','VIC','3175','03921 25321','2003/12/12'); Query OK, 1 row affected (0.11 sec) mysql> insert into tblCTCustomer -> values(14,'Stone','John','5 Haily St','Cliffton Hill','VIC','3111','03932 41234','2004/01/1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(15,'Smith','Brian','12 Lonsdale St','Dandenong','VIC','3175','0399 7951234','2004/01/2'); Query OK, 1 row affected (0.01 sec) mysql> insert into tblCTCustomer -> values(16,'Jones','Heidi','2 Cluff St','Frankston','VIC','3188','03976623 45','2004/05/3'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(17,'Green','Mary','45 Swan St','Noble Park','VIC','3174','03999434 56','2004/03/1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(18,'Black','Tom','5 Appen Wy','Berwick','VIC','2185','0397772987', '2004/04/2'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(19,'Black','Helen','5 Appen Wy','Berwick','VIC','2185','0397772987 ','2004/04/2'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(20,'Smith','Ian','20 Lonsdale St','Dandenong','VIC','3175','039795 1256','2004/01/2'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(21,'Brown','Jeff','4 Harold St','Noble Park','VIC','3174','0399943 776','2004/04/1'); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTCustomer -> values(22,'Brown','John','4 Gill St','Box Hill Sth ','VIC','3128','039808 9876','2004/04/1'); Query OK, 1 row affected (0.00 sec) _________________ mysql> insert into tblCTSupplier -> values(1,'General Motors Holden','1 Graeme St','Port Melbourne','VIC','30 23','0399912345'); Query OK, 1 row affected (0.01 sec) mysql> insert into tblCTSupplier -> values(2,'Ford Motor Company ','123 Melbourne Rd ','Geelong ','VIC','3222 ','0352226789 '); Query OK, 1 row affected (0.02 sec) mysql> insert into tblCTSupplier -> values(3,'Toyota Motor Company ','12 Old Geelong Rd ','Altona ','VIC','31 56 ','0394561234 '); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTSupplier -> values(4,'Volvo Australia ','2 Latrobe St ','Melbourne ','VIC','3002 ','0 345678934 '); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTSupplier -> values(5,'Mercedes Benz Australia','23 Charles St ','Surrey Hill ','NSW', '2111 ','0298281234 '); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTSupplier -> values(6,'Mitsubishi Australia ','45 Motor Dr ','Elisabeth ','SA','5456 ' ,'0578961234 '); Query OK, 1 row affected (0.00 sec) mysql> insert into tblCTSupplier -> values(8,'Australian Automotive Cooling ','34 Gippsland Hwy ','Dandenong ','VIC','3175 ','0397981234 '); Query OK, 1 row affected (0.00 sec) __________ Section 2: 1. List the structure of each of the tables that you have created mysql> describe tblCTCustomer; +-----------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-------------+------+-----+---------+-------+ | fldCTCustomerId | int(4) | | PRI | 0 | | | fldCTFamilyName | varchar(30) | YES | | NULL | | | fldCTGivenName | varchar(30) | YES | | NULL | | | fldCTAddress | varchar(50) | YES | | NULL | | | fldCTCity | varchar(40) | YES | | NULL | | | fldCTState | char(3) | YES | | NULL | | | fldCTPostCode | varchar(4) | YES | | NULL | | | fldCTPhone | varchar(10) | YES | | NULL | | | fldCTJoinDate | date | YES | | NULL | | +-----------------+-------------+------+-----+---------+-------+ 9 rows in set (0.00 sec) mysql> select fldCTCustomerId, fldCTFamilyName, fldCTGivenName,fldCTAddress from tblCTCustomer; +-----------------+-----------------+----------------+----------------+ | fldCTCustomerId | fldCTFamilyName | fldCTGivenName | fldCTAddress | +-----------------+-----------------+----------------+----------------+ | 13 | McCormack | Bob | 121 Stud Rd | | 14 | Stone | John | 5 Haily St | | 15 | Smith | Brian | 12 Lonsdale St | | 16 | Jones | Heidi | 2 Cluff St | | 17 | Green | Mary | 45 Swan St | | 18 | Black | Tom | 5 Appen Wy | | 19 | Black | Helen | 5 Appen Wy | | 20 | Smith | Ian | 20 Lonsdale St | | 21 | Brown | Jeff | 4 Harold St | | 22 | Brown | John | 4 Gill St | +-----------------+-----------------+----------------+----------------+ 10 rows in set (0.00 sec) mysql> select fldCTCity, fldCTState, fldCTPostCode,fldCTPhone,fldCTJoinDate from tblCTCustomer; +---------------+------------+---------------+------------+---------------+ | fldCTCity | fldCTState | fldCTPostCode | fldCTPhone | fldCTJoinDate | +---------------+------------+---------------+------------+---------------+ | Dandenong | VIC | 3175 | 0392125321 | 2003-12-12 | | Cliffton Hill | VIC | 3111 | 0393241234 | 2004-01-01 | | Dandenong | VIC | 3175 | 0399795123 | 2004-01-02 | | Frankston | VIC | 3188 | 0397662345 | 2004-05-03 | | Noble Park | VIC | 3174 | 0399943456 | 2004-03-01 | | Berwick | VIC | 2185 | 0397772987 | 2004-04-02 | | Berwick | VIC | 2185 | 0397772987 | 2004-04-02 | | Dandenong | VIC | 3175 | 0397951256 | 2004-01-02 | | Noble Park | VIC | 3174 | 0399943776 | 2004-04-01 | | Box Hill Sth | VIC | 3128 | 0398089876 | 2004-04-01 | +---------------+------------+---------------+------------+---------------+ 10 rows in set (0.00 sec) _____________________________ mysql> describe tblCTInvoice; +------------------+--------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+--------+------+-----+---------+-------+ | fldCTInvoiceId | int(4) | | PRI | 0 | | | fldCTCustomerId | int(4) | YES | | NULL | | | fldCTInvoiceDate | date | YES | | NULL | | +------------------+--------+------+-----+---------+-------+ 3 rows in set (0.00 sec) mysql> select * from tblCTInvoice; +----------------+-----------------+------------------+ | fldCTInvoiceId | fldCTCustomerId | fldCTInvoiceDate | +----------------+-----------------+------------------+ | 1 | 13 | 2004-08-01 | | 2 | 13 | 2004-07-13 | | 3 | 14 | 2004-08-02 | | 4 | 14 | 2004-08-10 | | 5 | 15 | 2004-08-10 | +----------------+-----------------+------------------+ 5 rows in set (0.00 sec) _________________________________ mysql> describe tblCTInvoiceLine; +----------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+-----+---------+-------+ | fldCTInvoiceId | int(4) | | PRI | 0 | | | fldCTStockId | int(4) | | PRI | 0 | | | fldCTPrice | decimal(8,0) | YES | | NULL | | | fldCTQuantity | int(2) | YES | | NULL | | | fldCTTax | decimal(8,0) | YES | | NULL | | +----------------+--------------+------+-----+---------+-------+ 5 rows in set (0.00 sec) mysql> select * from tblCTInvoiceline; +----------------+--------------+---------------+------------+----------+ | fldCTInvoiceId | fldCTStockId | fldCTQuantity | fldCTPrice | fldCTTax | +----------------+--------------+---------------+------------+----------+ | 1 | 2 | 1 | 100.00 | 10.00 | | 1 | 3 | 2 | 75.00 | 7.00 | | 1 | 4 | 1 | 190.00 | 19.00 | | 2 | 1 | 2 | 100.00 | 10.00 | | 2 | 6 | 2 | 35.00 | 3.00 | | 2 | 7 | 1 | 35.00 | 3.00 | | 2 | 11 | 1 | 125.00 | 12.00 | | 3 | 12 | 1 | 3500.00 | 350.00 | | 4 | 1 | 1 | 100.00 | 10.00 | | 4 | 3 | 2 | 75.00 | 7.00 | +----------------+--------------+---------------+------------+----------+ 10 rows in set (0.00 sec) __________________________ mysql> describe tblCTStock; +------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+--------------+------+-----+---------+-------+ | fldStockId | int(4) | | PRI | 0 | | | fldCTDescription | varchar(50) | YES | | NULL | | | fldCTManId | varchar(15) | YES | | NULL | | | fldCTCost | decimal(8,0) | YES | | NULL | | | fldCTTaxRate | float | YES | | NULL | | | fldCTSupplierId | int(4) | YES | | NULL | | +------------------+--------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) mysql> select fldStockId, fldCTDescription,fldCTManId, fldCTCost fldCTTaxRate fr om tblCTStock; +------------+---------------------+------------+--------------+ | fldStockId | fldCTDescription | fldCTManId | fldCTTaxRate | +------------+---------------------+------------+--------------+ | 1 | Fuel pump | VFP12346 | 100 | | 2 | Fuel pump | VFP12347 | 125 | | 3 | Coil | VFP12349 | 75 | | 4 | Radiator Core | VFP12334 | 190 | | 5 | Radiator top tank | FMC12345 | 150 | | 6 | Heater core | AAC4567894 | 35 | | 7 | Oil pressure sensor | MA4567890 | 35 | | 8 | LSD complete | MBA12345 | 1500 | | 9 | Windscreen | GMH12890 | 700 | | 10 | Windscreen | GMH12891 | 550 | | 11 | Fuel pump | GMH12347 | 125 | | 12 | Gearbox complete | GMH54321 | 3500 | | 13 | Gearbox complete | GMH54325 | 5500 | | 14 | Gearbox complete | FMC54321 | 3500 | | 15 | LSD complete | FMC54324 | 1500 | +------------+---------------------+------------+--------------+ 15 rows in set (0.00 sec) mysql> select fldCTSupplierId from tblCTStock; +-----------------+ | fldCTSupplierId | +-----------------+ | 4 | | 4 | | 4 | | 4 | | 2 | | 8 | | 6 | | 5 | | 1 | | 1 | | 1 | | 1 | | 1 | | 2 | | 2 | +-----------------+ 15 rows in set (0.00 sec) ________________________ mysql> describe tblCTSupplier; +-------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-------------+------+-----+---------+-------+ | fldCTSupplierId | int(4) | | PRI | 0 | | | fldCTSupplierName | varchar(50) | YES | | NULL | | | fldCTAddress | varchar(50) | YES | | NULL | | | fldCTCity | varchar(40) | YES | | NULL | | | fldCTState | char(3) | YES | | NULL | | | fldCTPostCode | varchar(4) | YES | | NULL | | | fldCTPhone | varchar(10) | YES | | NULL | | +-------------------+-------------+------+-----+---------+-------+ 7 rows in set (0.00 sec) _________________ mysql> select fldCTSupplierId,fldCTSupplierName,fldCTAddress from tblCTSupplier; +-----------------+-------------------------------+-------------------+ | fldCTSupplierId | fldCTSupplierName | fldCTAddress | +-----------------+-------------------------------+-------------------+ | 1 | General Motors Holden | 1 Graeme St | | 2 | Ford Motor Company | 123 Melbourne Rd | | 3 | Toyota Motor Company | 12 Old Geelong Rd | | 4 | Volvo Australia | 2 Latrobe St | | 5 | Mercedes Benz Australia | 23 Charles St | | 6 | Mitsubishi Australia | 45 Motor Dr | | 8 | Australian Automotive Cooling | 34 Gippsland Hwy | +-----------------+-------------------------------+-------------------+ 7 rows in set (0.00 sec) mysql> select fldCTCity,fldCTState,fldCTPostCode, fldCTPhone from tblCTSupplier; +----------------+------------+---------------+------------+ | fldCTCity | fldCTState | fldCTPostCode | fldCTPhone | +----------------+------------+---------------+------------+ | Port Melbourne | VIC | 3023 | 0399912345 | | Geelong | VIC | 3222 | 0352226789 | | Altona | VIC | 3156 | 0394561234 | | Melbourne | VIC | 3002 | 0345678934 | | Surrey Hill | NSW | 2111 | 0298281234 | | Elisabeth | SA | 5456 | 0578961234 | | Dandenong | VIC | 3175 | 0397981234 | +----------------+------------+---------------+------------+ 7 rows in set (0.00 sec) _________ Section 3 mysql> select fldCTFamilyName,fldCTGivenName,fldCTPhone from tblCTCustomer where fldCTCity = "Berwick"; +-----------------+----------------+------------+ | fldCTFamilyName | fldCTGivenName | fldCTPhone | +-----------------+----------------+------------+ | Black | Tom | 0397772987 | | Black | Helen | 0397772987 | +-----------------+----------------+------------+ 2 rows in set (0.03 sec) mysql> select fldCTFamilyName,fldCTGivenName,fldCTPhone from tblCTCustomer where fldCTPostCode = "3128" and fldCTFamilyName ="Brown"; +-----------------+----------------+------------+ | fldCTFamilyName | fldCTGivenName | fldCTPhone | +-----------------+----------------+------------+ | Brown | John | 0398089876 | +-----------------+----------------+------------+ 1 row in set (0.00 sec) mysql> select fldCTPhone from tblCTCustomer where fldCTCustomerId='20'; +------------+ | fldCTPhone | +------------+ | 0397894321 | +------------+ 1 row in set (0.00 sec) mysql> use ctpos; Database changed mysql> select fldCTPhone from tblCTCustomer where fldCTFamilyName='Smith' and fl dCTGivenName='Ian'; +------------+ | fldCTPhone | +------------+ | 0397894321 | +------------+ 1 row in set (0.03 sec) mysql> update tblCTCustomer set fldCTPhone = '0397894320' where fldCTFamilyName= 'Smith' and fldCTGivenName='Ian'; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select fldCTPhone from tblCTCustomer where fldCTFamilyName='Smith' and fl dCTGivenName='Ian'; +------------+ | fldCTPhone | +------------+ | 0397894320 | +------------+ 1 row in set (0.00 sec) mysql> update tblctcustomer set fldctCreditLimit = '5000'; Query OK, 10 rows affected (0.00 sec) Rows matched: 10 Changed: 10 Warnings: 0 mysql> select fldCTCreditLimit from tblctcustomer; +------------------+ | fldCTCreditLimit | +------------------+ | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | | 5000.00 | +------------------+ 10 rows in set (0.00 sec) _________ Section 4 mysql> select fldCTInvoiceId from tblCTInvoice where fldCTInvoiceDate='2004-08-10'; +----------------+ | fldCTInvoiceId | +----------------+ | 4 | | 5 | +----------------+ 2 rows in set (0.00 sec) mysql> select fldCTFamilyName, fldCTGivenName, fldCTAddress from tblCTCustomer where fldCTCustomerId=4 and fldCTCustomerId=5; Empty set (0.06 sec) mysql> select fldCTCustomerId, fldCTFamilyName, fldCTGivenName, fldCTAddress from tblCTCustomer; +-----------------+-----------------+----------------+----------------+ | fldCTCustomerId | fldCTFamilyName | fldCTGivenName | fldCTAddress | +-----------------+-----------------+----------------+----------------+ | 13 | McCormack | Bob | 121 Stud Rd | | 14 | Stone | John | 5 Haily St | | 15 | Smith | Brian | 12 Lonsdale St | | 16 | Jones | Heidi | 2 Cluff St | | 17 | Green | Mary | 45 Swan St | | 18 | Black | Tom | 5 Appen Wy | | 19 | Black | Helen | 5 Appen Wy | | 20 | Smith | Ian | 20 Lonsdale St | | 21 | Brown | Jeff | 4 Harold St | | 22 | Brown | John | 4 Gill St | +-----------------+-----------------+----------------+----------------+ 10 rows in set (0.01 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=1; +---------------+ | avg(fldCTTax) | +---------------+ | 10.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=2; +---------------+ | avg(fldCTTax) | +---------------+ | 10.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=3; +---------------+ | avg(fldCTTax) | +---------------+ | 7.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=4; +---------------+ | avg(fldCTTax) | +---------------+ | 19.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=6; +---------------+ | avg(fldCTTax) | +---------------+ | 3.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=7; +---------------+ | avg(fldCTTax) | +---------------+ | 3.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=11; +---------------+ | avg(fldCTTax) | +---------------+ | 12.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select avg(fldCTTax) from tblCTInvoiceLine where fldCTStockId=12; +---------------+ | avg(fldCTTax) | +---------------+ | 350.0000 | +---------------+ 1 row in set (0.00 sec) mysql> select sum(fldCTPrice) from tblCTInvoiceLine where fldCTStockId=2; +-----------------+ | sum(fldCTPrice) | +-----------------+ | 100.00 | +-----------------+ 1 row in set (0.02 sec) mysql> select fldCTCustomerId, count(fldCTCustomerId) from tblCTInvoice group by fldCTCustomerId; +-----------------+------------------------+ | fldCTCustomerId | count(fldCTCustomerId) | +-----------------+------------------------+ | 13 | 2 | | 14 | 2 | | 15 | 1 | +-----------------+------------------------+ 3 rows in set (0.05 sec)