0% found this document useful (0 votes)
33 views1 page

Postgresql Prisma Commands Bullets

The document compares PostgreSQL shell commands with Prisma ORM commands for various database operations. It outlines how to connect to databases, show databases and tables, create and drop databases and tables, and perform CRUD operations using both PostgreSQL and Prisma. Each command is presented side-by-side for easy reference between the two systems.

Uploaded by

Mayank Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Postgresql Prisma Commands Bullets

The document compares PostgreSQL shell commands with Prisma ORM commands for various database operations. It outlines how to connect to databases, show databases and tables, create and drop databases and tables, and perform CRUD operations using both PostgreSQL and Prisma. Each command is presented side-by-side for easy reference between the two systems.

Uploaded by

Mayank Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PostgreSQL Shell Commands vs Prisma ORM

Commands
• Connect to DB
PostgreSQL: \c dbname
Prisma: prisma.$connect()
• Show databases
PostgreSQL: \l
Prisma: Not directly (list via schema inspector / raw query)
• Show tables
PostgreSQL: \dt
Prisma: prisma..findMany()
• Describe table
PostgreSQL: \d tablename
Prisma: prisma..findMany({ select: {...} })
• Create database
PostgreSQL: CREATE DATABASE dbname;
Prisma: Use migrations: npx prisma migrate dev --name init
• Drop database
PostgreSQL: DROP DATABASE dbname;
Prisma: Handled outside Prisma (raw SQL or DB tool)
• Create table
PostgreSQL: CREATE TABLE ...;
Prisma: Define model in schema.prisma + migrate
• Drop table
PostgreSQL: DROP TABLE tablename;
Prisma: Remove model + migrate
• Insert row
PostgreSQL: INSERT INTO table (...) VALUES (...);
Prisma: prisma..create({ data: {...} })
• Update row
PostgreSQL: UPDATE table SET ... WHERE ...;
Prisma: prisma..update({ where: {...}, data: {...} })
• Delete row
PostgreSQL: DELETE FROM table WHERE ...;
Prisma: prisma..delete({ where: {...} })
• Select rows
PostgreSQL: SELECT * FROM table;
Prisma: prisma..findMany()
• Select with condition
PostgreSQL: SELECT * FROM table WHERE ...;
Prisma: prisma..findMany({ where: {...} })
• Count rows
PostgreSQL: SELECT COUNT(*) FROM table;
Prisma: prisma..count()
• Raw query
PostgreSQL: Any SQL
Prisma: prisma.$queryRaw`SQL_QUERY`

You might also like