Thursday, November 7, 2013

SQL

I spent most of the day changing around the tables so that they are exactly like the ones in the manga but I wasted a lot of time with silly mistakes. I was able to finally get this chunk of code working which was kind of annoying.

sqlite> SELECT sales.report_code, dates, sales.export_destination_code, export_destination_name, sales_statement.product_code, product_name, unit_price
   ...> FROM sales, sales_statement, product, export_destination
   ...> WHERE sales.report_code = sales_statement.report_code
   ...> AND
   ...> sales_statement.product_code = product.product_code
   ...> AND
   ...> export_destination.export_destination_code = sales.export_destination_code;
1101|3/5|12|KINGDOM OF MINANMI|101|MELON|800
1101|3/5|12|KINGDOM OF MINANMI|102|STRAWBERRY|150
1102|3/7|23|ALPHA EMPIRE|103|APPLE|120
1103|3/8|25|THE KINGDOM OF RITOL|104|LEMON|200
1104|3/10|12|KINGDOM OF MINANMI|101|MELON|800
1105|3/12|25|THE KINGDOM OF RITOL|103|APPLE|120
1105|3/12|25|THE KINGDOM OF RITOL|104|LEMON|200

1 comment:

  1. I'm going to ask you for .sql files that can be used to create all the tables in the Manga book. We will talk today in class about this.

    ReplyDelete