Perbezaan Antara Left,Right dan Inner Join (SQL)

Assalamualaikum & Salam Sejahtera,

Sudah agak lama saya tidak menghantar artikel yer? Kali ini saya hanya ingin berkongsi dengan anda sedikit penerangan dan perbezaan tentang Left, Right dan Inner Join di dalam SQL Syntax icon wink Perbezaan Antara Left,Right dan Inner Join (SQL)

THE DIFFERENCES IS IN THE WAY TABLES ARE JOINED IF THERE ARE NO COMMON RECORDS.

JOIN is same as INNER JOIN and means to only show records common to both tables. Whether the records are common is determined by the fields in join clause. For example:

FROM table1
JOIN table2 on table1.ID = table2.ID

means show only records where the same ID value exists in both tables.

LEFT JOIN is same as LEFT OUTER JOIN and means to show all records from left table (i.e. the one that precedes in SQL statement) regardless of the existance of matching records in the right table.

RIGHT JOIN is same as RIGHT OUTER JOIN and means opposite of LEFT JOIN, i.e. shows all records from the second (right) table and only matching records from first (left) table.

Read the rest of this entry »

Basic SQL Queries

Ingin saya kongsikan di sini basic SQL queries yang biasa digunakan untuk mendapatkan sebarang maklumat daripada database anda:-

SELECT Statement
Syntax:
Select * from table_name where condition
Example:
select * from tfcust where custid=’00002′

The query will select all the data which match the condition Customer ID is equal to 00002.

Read the rest of this entry »