Inner Join example in MySQL

Rating 3.50 out of 5

Suppose we have two different tables in Database, one having product ID and product name and the other having product ID and price, as shown below,

Table_1

product_id

product_name

1

Car

2

Truck

3

Scooter

4

Bicycle

Table_2

product_id

product_price

1

50000

2

60000

3

5000

4

1000

then to show the product names with their price, we can write an SQL statement (Inner Join) like this,

SELECT a.product_name, b.product_price FROM Table_1 a, Table_2 WHERE a.product_id=b.product_id;

This . . . → Read More: Inner Join example in MySQL

Common mistakes and points to remember in MySQL

Rating 3.00 out of 5

Some common mistakes we often commit while coding in PHP to access MySQL DB (Database).

1. For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error. For other type of SQL statements like INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success . . . → Read More: Common mistakes and points to remember in MySQL

Sanitize User Input with MySQL

Rating 3.00 out of 5

Never believe your user would always provide you with the correct or expected input. People can play around with your security and mess up with the important data. You might end up losing your customers or their data (emails or passwords) or may be your website.

Always protect your code and database from . . . → Read More: Sanitize User Input with MySQL