Select records from a table where no corresponding records available in other table

Sometimes there is a need to select records from Table A where there are no corresponding records in Table B

e.g. If you have a products table with productid as primary key and you need to find products which did not get sold in a particular month from the sales table you can use following query


Import CSV data to MySQL table

Here is a simple code to import CSV data into a MySQL table.
There is no need to use MySQL frontend.
Below is web based form to select a CSV file and import the records in a MySQL table

Step 1: add.php First of all create a form to select the file
Note that the values of the select box should match the table names in the MySQL database e.g. table_name_A, table_name_B, etc

Step 2: config.php Create a config file
Always a good idea to create a config file to declare your database connection and file import settings.

Step 3: import.php Import the data