PostgreSQL-Database/C2/Basic-SELECT-Statement/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Title of the Script: Basic SELECT Statement

Author: EduPyramids

Keywords: postgreSQL, pgadmin 4, SELECT statement, asterisk operator, retrieve all the data, EduPyramids, Video Tutorial.


Visual Cue Narration
Slide 1

Title Slide

Welcome to this Spoken Tutorial on Basic SELECT Statement.
Slide 2

Learning Objectives

In this tutorial we will learn about,
  • SELECT statement and
  • Asterisk(*) Operator
Slide 3

System Requirement

To record this tutorial, I am using
  • Ubuntu 24.04 LTS.
  • PostgresQL version 18.1 and
  • PgAdmin 4 version 9.11
Slide 4

Prerequisite

To follow this tutorial,
  • Learners should have PostgreSQL and pgAdmin 4.
  • For the pre-requisite PostgreSQL tutorials, please visit this website.
Slide 5

Code Files

  • bs-code.txt


The following code file is required to practice this tutorial.

This file is provided in the Code Files link of this tutorial page.

Let us learn about the SELECT statement.
Slide 6

SELECT statement

The SELECT statement retrieves data from one or more tables in PostgreSQL.

It does not modify the data, but only displays the stored data.

Let’s get started.
Show localhost server node Please ensure that you are connected to the Localhost PostgreSQL server.
Select Studentdb In the Browser pane, expand the Student db database.
Click students tableClick Columns node Let us click on the students table.

Let us next click on the Columns node.

Slide 7

SELECT statement

SELECT statement is used to select all columns or specific columns from a table.

Ensure that a table containing data already exists.

Slide 8 Imagine a notebook with many student records.

How do we read the stored information easily?

Slide 9 In databases, we use the SELECT statement to read data.

Pause and think of asking for details from a register.

Show the pgAdmin 4 records.Highlight Table. Here, the table named students already exists.

This table stores student information.

Type: SELECT * FROM students; Let us retrieve all the data from the table.

Type this command in the query window.

Highlight *(asterisk) The asterisk symbol selects all the columns.

This command displays the entire data.

Click on the Execute query button. Let us execute the query.
Highlight output: Pause and observe the output carefully.Sometimes, we need only selected information.
Highlight: studentname column and dob column Let us select studentname and d o b columns.
Type: SELECT studentname, dob FROM students;

Click the Execute query button.

Now type the command.SELECT studentname, dob FROM students;

Lets Execute the query.

Highlight output. Notice that only studentname and dob columns are displayed.

Other columns are not shown in the output.

Let us compare the results of both the queries.
Split output view The first query shows all columns from the table.

The second query shows only the selected columns.

Slide 10

Summary

In this tutorial we have learnt about,

  • SELECT statement.
  • Asterisk(*) Operator


With this we come to the end of this tutorial.

Let us summarise.

Slide 11

Assignment

As an Assignment,

  • Write a SELECT query to display only the gender
  • Execute the query on the students table
  • Observe the output


As an assignment, please do the following.
Slide 12

Thank you

This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited SINE IIT Bombay.

Thank you for joining.

Contributors and Content Editors

Madhurig