PostgreSQL-Database/C2/Creating-a-Database-using-a-Terminal/English
Title of the script: Creating a Database using a terminal
Author: EduPyramids
Keywords: RDBMS, PostgreSQL, pgAdmin, Database, table, field, record, EduPyramids, video tutorial.
| Visual Cue | Narration |
| Slide 1
Title Slide |
Welcome to the Spoken Tutorial on Creating a Database using a Terminal. |
| Slide 2
Learning Objectives |
In this tutorial we will learn to,
|
| Slide 3
System Requirements |
To record this tutorial, I am using
|
| Slide 4
Pre-requisites |
To follow this tutorial,
|
| Slide 5
Code Files
This file is provided in the code files link of this tutorial page. |
The following code file is required to practise this tutorial.
|
| Press Ctrl, Alt and T keys together. | Let us open the terminal. |
| Terminal window displayed | We will create a database using Post gres Q L C L I. |
| Type: sudo systemctl status postgresqlPress Enter.
Type the system password to authenticate. |
Type sudo space system c t l space status space post gres q l and press Enter.
If prompted type the admin password to authenticate. |
| Point to the displayed output:
Highlight output: Active: acitve |
The Post gres Q L service status is now displayed.
|
| Press q to exit. | Press q to exit from the status. |
| Type: sudo -i -u postgresPress Enter. | Type the following command to switch to the postgres user and press Enter. |
| Highlight:
postgres@spoken-Latitude-3480:~$ |
Notice that we are logged in as postgres user. |
| Type p s q l | To Access p s q l prompt.
Type p s q l and press Enter. |
| psql prompt displayed
Highlight postgres=# |
This is the Post gres Q L interactive terminal.
Observe that prompt changes into postgres equal to hash. |
| Type \l | To list all the existing databases type backslash l. |
| Highlight output
Scroll through the output. |
Observe the list of available databases. |
| Press q to exit | Press q to exit. |
| Cursor on the termainal. | Let us create a new database named sports d b. |
| Type: CREATE DATABASE sportsdb; | Type CREATE DATABASE sports d b semicolon and press Enter to execute the command. |
| Highlight CREATE DATABASE message. | The database is created successfully. |
| Type: \l and press Enter. | Type backslash l and press Enter to verify that sports d b is created. |
| Highlight sportsdb | The new database appears in the list. |
| Type : q | Type q to exit. |
| Type \c sportsdb | Now, type backslash c space sports d b and press Enter to connect to the sports d b database. |
| Highlight success message | Here we can see the output as,
You are now connected to database sports d b as user postgres. |
| Type \q and press Enter. | Type backslash q to exit from the p s q l prompt. |
| Type: exit and press Enter. | Type exit to exit from postgres user. |
| With this we come to the end of this tutorial. | |
| Slide 6
In this tutorial we learnt to,
|
Let us summarise. |
| Slide 7
Assignment As an Assignment,* Create and verify a database named accountsdb. |
As an Assignment, please do the following. |
| Slide 8
Thank you |
This Spoken Tutorial is brought to you by Edupyramids Educational Services Private Limited, SINE, IIT Bombay.
Thank you. |