SQL Commands: Difference between revisions

From Fact Weaver
No edit summary
No edit summary
Line 1: Line 1:
Below I have listed the most common commands that I am using when acquiring data from a database
Below I have listed the most common commands that I am using when acquiring data from a database
<code> This </code>
 
Selecting a single Column from a table:
<code>  
SELECT name
FROM people;
</code>
This will select the column "Name" from the "People" Table.
 
Selecting multiple columns from a table:
<code>
SELECT name, birthdate
FROM people;
</code>
This will select the Name and Birthrate column from the people table.
 
<code>
SELECT *
FROM people;
</code>
This will select all columns from a table.
 
<code>
SELECT *
FROM people
LIMIT 10;
</code>
This will select 10 rows with all columns from a table.

Revision as of 02:04, 12 September 2023

Below I have listed the most common commands that I am using when acquiring data from a database

Selecting a single Column from a table: SELECT name FROM people; This will select the column "Name" from the "People" Table.

Selecting multiple columns from a table: SELECT name, birthdate FROM people; This will select the Name and Birthrate column from the people table.

SELECT * FROM people; This will select all columns from a table.

SELECT * FROM people LIMIT 10; This will select 10 rows with all columns from a table.