DEV Community

R.Shobika CSE
R.Shobika CSE

Posted on

PostgreSQL day-1

DBMS:

  • DBMS stands for "Database Management System"

  • It is used to manage the data from the database

  • DBMS is a software is allow to create, update and retrieval of data in a Organized way

RDBMS:

  • RDBMS stands for "Relational Database Management System"

  • RDBMS is a program used to maintain relational Database.

  • The data in RDBMS store in table format . A table is a collection of related entity (entity means things).

SQL:

  • SQL stands for "Structured Query Language".

  • SQL lets you access and manipulate databases.

PostgreSQL:

  • PostgreSQL is a Relational Database Management System

  • It is a open source RDBMS it is used to store, manage, retrieve and Manipulate the data

Difference between PostgreSQL and MySQL

PostgreSQL MySQL
More advanced Beginner friendly
Open Source Open Source
Large applications Small & Medium applications
Better performance for complex queries Faster for simple queries

Installation of PostgreSQL:

1. sudo apt update
2. sudo apt install postgresql postgresql-contrib
3. sudo systemctl status postgresql
4. sudo systemctl enable postgresql
5. sudo -i -u postgres
6.PSQL
Enter fullscreen mode Exit fullscreen mode

comments of PostgreSQL

\h ---> help
\l ---> list
\r ---> stop/recover
\c ---> connect
Enter fullscreen mode Exit fullscreen mode

CREATION OF DATABASE:

CREATE database college;
\c ---> connect the database
Enter fullscreen mode Exit fullscreen mode

*TABLE CREATION *

CREATE table student(
stdroll int,
stdname varchar(20),
department varchar(10),
year int,
);
Enter fullscreen mode Exit fullscreen mode

INSERT DATA INTO A TABLE:

// single value insert
INSERT INTO student values ('01','shobi','CSE',4);

// multiple value insert
INSERT INTO student values ('02','shiva','ECE',3),('03','ajitha','EEE',2);

// we can change the order of the values
INSERT Into student (stdname, stdroll, department, year) values ( 'abi','09','IT',1);
Enter fullscreen mode Exit fullscreen mode

SELECT THE VALUES IN A TABLE

SELECT * from student;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)