Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

SQL For Data Analytics Lab Manual

To create a database and table in PostgreSQL: 1) Right click on Databases and select Create then Database to make a new database like "Classroom" 2) Right click on the new database, select Query Tool to open it, then right click again and select Create then Table to make a table like "SQL_class" with fields like "Roll_No, Name, SQL_marks" 3) Data can be inserted into the table using procedures like writing an INSERT statement for a single or multiple rows, or by importing CSV files placed in the PostgreSQL data folder.

Uploaded by

CSE HOD
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

SQL For Data Analytics Lab Manual

To create a database and table in PostgreSQL: 1) Right click on Databases and select Create then Database to make a new database like "Classroom" 2) Right click on the new database, select Query Tool to open it, then right click again and select Create then Table to make a table like "SQL_class" with fields like "Roll_No, Name, SQL_marks" 3) Data can be inserted into the table using procedures like writing an INSERT statement for a single or multiple rows, or by importing CSV files placed in the PostgreSQL data folder.

Uploaded by

CSE HOD
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

PG Admin Password: welcome

To create a Database: Right click on Databases CreateDatabase


To Create a Table: Right click on SampleQuery Tool
Table is created.
To see the Table: 1) Refresh Sample Database
2) Click SampleClick Schema Click Public Click Tables
Here we can find the table that is created.
3) Right click the Student_table View/Edit DataAll Rows
Table with field names is created successfully.
Exercise: 1
Create a Database ‘Classroom’
Create a table named ‘SQL _class’ with 3 properties Roll_No, Name, SQL_marks
To insert values into the table:
Procedure 1: Single Row without column names specified

Procedure 2: Single Row with column names specified


(Note: This is the case where the student doesn’t have a second name for example)
Procedure 3: Multiple rows
Importing CSV file into Table:
STEP 1: Create one excel file and text file
STEP 2: Place these two files where PostgreSQL is installed (Create a folder by name
COPYDATA in DATA folder and place it)
Excel File Content
Text File Content:

To import CSV file:


To import Text File:
Exercise: 2
Insert 15 students data into SQL_class using insert into command
Import data from csv file to SQL_class to inset data of next 10 students

You might also like