Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to know if table in rigt or left in sql

-- People:           -- Car
id | name            owner_id | model
---+------------     ---------+------------
1  | Paul            1        | Ferrari
2  | Nancy           2        | Porsche
3  | Arthur          NULL     | Lamborghini
4  | Alfred          10       | Maserati

> select people.name, car.model from people join car on car.owner_id=people.id;

name     | model
---------+--------------
Paul     | Ferrari
Nancy    | Porsche
2 record(s) found

> select people.name, car.model from people left join car on 
  car.owner_id=people.id;

name     | model
---------+--------------
Paul     | Ferrari
Nancy    | Porsche
Arthur   | NULL
Alfred   | NULL     
4 record(s) found

> select people.name, car.model from people left join car on 
  people.id = car.owner_id;

name     | model
---------+--------------
Paul     | Ferrari
Nancy    | Porsche
Arthur   | NULL
Alfred   | NULL     
4 record(s) found
Comment

PREVIOUS NEXT
Code Example
Sql :: online convert linq to sql query 
Sql :: mysql docker image arjun 
Sql :: mysql order by where condition sub query 
Sql :: how to user id to show in from date to upto date in mssql server 
Sql :: mysql where in keep order 
Sql :: optimize sql query 
Sql :: sql server in linux 
Sql :: SQL server datetime compare 
Sql :: how to get alternate records from a table in sql 
Sql :: phpmyadmin access denied 
Sql :: how to insert multiple values in a single column in sql 
Sql :: is not null mysql 
Sql :: Data type and their numeric form 
Sql :: sql int size 
Sql :: smalldatetime in sql 
Sql :: retornar apenas o ano mysql date 
Sql :: mysql install windows 10 
Csharp :: how to make mouse invisible unity 
Csharp :: c# char input 
Csharp :: ngrok for asp.net core 
Csharp :: how to delete all files in a directory c# 
Csharp :: create or update in laaravel 
Csharp :: wpf numeric only textbox 
Csharp :: how to set a custom size for window in monogame 
Csharp :: Program for factorial of a number in c# 
Csharp :: c# get directory of executable 
Csharp :: c# datetime current 
Csharp :: c# check if list contains string case insensitive 
Csharp :: how to get rigidbody speed in unity 
Csharp :: c# try catch with error message 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =