SlideShare a Scribd company logo
List database, schemas and tables
? show help
h SQL syntax help
h create table SQL help for create table
l list databases
c mydb connect to mydb database
dn list schemas from a database
dt list tables from public schema
dt sgn.* list tables from schema sgn
d blast_db show blast_db table details
o file.txt send output to file
q quit psql
SQL development commands
CREATE DATABASE mydb;
ALTER DATABASE mydb RENAME TO newname;
DROP DATABASE mydb;
CREATE TABLE mytable (col_name type constraints);
ALTER TABLE mytable RENAME TO newname;
DROP TABLE mytable CASCADE;
ALTER TABLE mytable ADD COLUMN column_name column_type;
ALTER TABLE mytable RENAME COLUMN column_name TO newname;
ALTER TABLE mytable DROP COLUMN column_name RESTRICT;
INSERT INTO mytable (column1,column2) VALUES (‘value1’,’value2’);
UPDATE mytable SET column1=‘value1’ WHERE column=value;
DELETE FROM mytable WHERE column=‘value’;
BEGIN; command; COMMIT; BEGIN; command; ROLLBACK;
PostgreSQL Cheat Sheet
BTI-SGN Databases Course 2016
SQL query commands
SELECT * FROM mytable;
SELECT mycolumn FROM mytable;
SELECT … WHERE mycolumn=‘value1’;
SELECT DISTINCT mycolumn FROM mytable;
SELECT COUNT(*) FROM mytable;
SELECT … ORDER BY mycolumn;
SELECT … WHERE mycolumn IN (1,2);
SELECT … WHERE mycolumn LIKE ‘%Abc%’;
SELECT … WHERE mycolumn ILIKE ‘%abc%’;
SELECT … WHERE mycolumn IS NULL;
SELECT … LIMIT 10;
SELECT … OFFSET 10;
SELECT … JOIN mytable USING(common_column);
SELECT … JOIN mytable ON(common_column1=common_column2);
Ad

More Related Content

What's hot (20)

Introduction to Apache Hive
Introduction to Apache HiveIntroduction to Apache Hive
Introduction to Apache Hive
Avkash Chauhan
 
Polyglot Persistence
Polyglot PersistencePolyglot Persistence
Polyglot Persistence
Scott Leberknight
 
Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015
StampedeCon
 
Introduction to scoop and its functions
Introduction to scoop and its functionsIntroduction to scoop and its functions
Introduction to scoop and its functions
Rupak Roy
 
Introduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLab
CloudxLab
 
Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export
Rupak Roy
 
Scalding: Reaching Efficient MapReduce
Scalding: Reaching Efficient MapReduceScalding: Reaching Efficient MapReduce
Scalding: Reaching Efficient MapReduce
LivePerson
 
Python database access
Python database accessPython database access
Python database access
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Apache cassandra in 2016
Apache cassandra in 2016Apache cassandra in 2016
Apache cassandra in 2016
Duyhai Doan
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
Scott Leberknight
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
AWS Hadoop and PIG and overview
AWS Hadoop and PIG and overviewAWS Hadoop and PIG and overview
AWS Hadoop and PIG and overview
Dan Morrill
 
Cassandra 3.0
Cassandra 3.0Cassandra 3.0
Cassandra 3.0
Robert Stupp
 
Scoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMSScoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMS
Rupak Roy
 
Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
Skills Matter
 
2012 03 08_dbi
2012 03 08_dbi2012 03 08_dbi
2012 03 08_dbi
Prof. Wim Van Criekinge
 
Solr 6 Feature Preview
Solr 6 Feature PreviewSolr 6 Feature Preview
Solr 6 Feature Preview
Yonik Seeley
 
Create & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptxCreate & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptx
vishal choudhary
 
Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...
Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...
Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...
Lucidworks
 
Introduction to Apache Hive
Introduction to Apache HiveIntroduction to Apache Hive
Introduction to Apache Hive
Avkash Chauhan
 
Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015
StampedeCon
 
Introduction to scoop and its functions
Introduction to scoop and its functionsIntroduction to scoop and its functions
Introduction to scoop and its functions
Rupak Roy
 
Introduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Sqoop | Big Data Hadoop Spark Tutorial | CloudxLab
CloudxLab
 
Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export
Rupak Roy
 
Scalding: Reaching Efficient MapReduce
Scalding: Reaching Efficient MapReduceScalding: Reaching Efficient MapReduce
Scalding: Reaching Efficient MapReduce
LivePerson
 
Apache cassandra in 2016
Apache cassandra in 2016Apache cassandra in 2016
Apache cassandra in 2016
Duyhai Doan
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
Scott Leberknight
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
AWS Hadoop and PIG and overview
AWS Hadoop and PIG and overviewAWS Hadoop and PIG and overview
AWS Hadoop and PIG and overview
Dan Morrill
 
Scoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMSScoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMS
Rupak Roy
 
Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
Skills Matter
 
Solr 6 Feature Preview
Solr 6 Feature PreviewSolr 6 Feature Preview
Solr 6 Feature Preview
Yonik Seeley
 
Create & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptxCreate & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptx
vishal choudhary
 
Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...
Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...
Faster Data Analytics with Apache Spark using Apache Solr - Kiran Chitturi, L...
Lucidworks
 

Similar to Sql cheat sheet (20)

SQL: Data Definition Language(DDL) command
SQL: Data Definition Language(DDL) commandSQL: Data Definition Language(DDL) command
SQL: Data Definition Language(DDL) command
sonali sonavane
 
Difference Between Sql - MySql and Oracle
Difference Between Sql - MySql and OracleDifference Between Sql - MySql and Oracle
Difference Between Sql - MySql and Oracle
Steve Johnson
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
Rc Os
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
ChryslerPanaguiton
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
ChryslerPanaguiton
 
SQL : Structured Query Language
SQL : Structured Query LanguageSQL : Structured Query Language
SQL : Structured Query Language
Abhishek Gautam
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
HudaRaghibKadhim
 
Creating a database
Creating a databaseCreating a database
Creating a database
Rahul Gupta
 
Ddl commands
Ddl commandsDdl commands
Ddl commands
Vasudeva Rao
 
Lecture 3 sql {basics ddl commands}
Lecture 3 sql {basics  ddl commands}Lecture 3 sql {basics  ddl commands}
Lecture 3 sql {basics ddl commands}
Shubham Shukla
 
Les10
Les10Les10
Les10
arnold 7490
 
Avinash database
Avinash databaseAvinash database
Avinash database
avibmas
 
Basic MySQL queries
Basic MySQL queriesBasic MySQL queries
Basic MySQL queries
Harish Gyanani
 
Basic MySQL queries
Basic MySQL queriesBasic MySQL queries
Basic MySQL queries
Harish Gyanani
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
NETsolutions Asia: NSA – Thailand, Sripatum University: SPU
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
webhostingguy
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
Adolfo Nasol
 
SQl data base management and design
SQl     data base management  and designSQl     data base management  and design
SQl data base management and design
franckelsania20
 
Ad

More from solgenomics (20)

Sl4.0 and ITAG4.0
Sl4.0 and ITAG4.0Sl4.0 and ITAG4.0
Sl4.0 and ITAG4.0
solgenomics
 
Cassavabase-PhenoApps demo ISTRC 2018
Cassavabase-PhenoApps demo ISTRC 2018Cassavabase-PhenoApps demo ISTRC 2018
Cassavabase-PhenoApps demo ISTRC 2018
solgenomics
 
Cassavabase-PhenoApp sample tracking
Cassavabase-PhenoApp sample trackingCassavabase-PhenoApp sample tracking
Cassavabase-PhenoApp sample tracking
solgenomics
 
breeding informatics solutions at SGN
breeding informatics solutions at SGNbreeding informatics solutions at SGN
breeding informatics solutions at SGN
solgenomics
 
Musabase PAG 2018
Musabase PAG 2018Musabase PAG 2018
Musabase PAG 2018
solgenomics
 
Cassavabase workshop ibadan March17
Cassavabase workshop ibadan March17Cassavabase workshop ibadan March17
Cassavabase workshop ibadan March17
solgenomics
 
Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)
Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)
Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)
solgenomics
 
SolGS Hyderabad conference 2016
SolGS Hyderabad conference 2016SolGS Hyderabad conference 2016
SolGS Hyderabad conference 2016
solgenomics
 
Musa base phenotyping workflow demo
Musa base phenotyping workflow demoMusa base phenotyping workflow demo
Musa base phenotyping workflow demo
solgenomics
 
SolGS workshop 2016
SolGS workshop 2016SolGS workshop 2016
SolGS workshop 2016
solgenomics
 
Cassavabase workshop IITA oct2016
Cassavabase workshop IITA oct2016Cassavabase workshop IITA oct2016
Cassavabase workshop IITA oct2016
solgenomics
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
solgenomics
 
YamBase phenotyping workflow demo
YamBase phenotyping workflow demoYamBase phenotyping workflow demo
YamBase phenotyping workflow demo
solgenomics
 
Introduction to YamBase
Introduction to YamBaseIntroduction to YamBase
Introduction to YamBase
solgenomics
 
Cassavabase general presentation PAG 2016
Cassavabase general presentation PAG 2016Cassavabase general presentation PAG 2016
Cassavabase general presentation PAG 2016
solgenomics
 
Cassavabase SolGS presentation PAG 2016
Cassavabase SolGS presentation PAG 2016Cassavabase SolGS presentation PAG 2016
Cassavabase SolGS presentation PAG 2016
solgenomics
 
Cassavabase SolGS poster PAG 2016
Cassavabase SolGS poster PAG 2016Cassavabase SolGS poster PAG 2016
Cassavabase SolGS poster PAG 2016
solgenomics
 
1 introduction to cassavabase
1  introduction to cassavabase 1  introduction to cassavabase
1 introduction to cassavabase
solgenomics
 
2 Cassavabase workshop: search menu
2  Cassavabase workshop: search menu2  Cassavabase workshop: search menu
2 Cassavabase workshop: search menu
solgenomics
 
3a Cassavabase worksop: manage breeding-program ands locations
3a  Cassavabase worksop: manage breeding-program ands locations3a  Cassavabase worksop: manage breeding-program ands locations
3a Cassavabase worksop: manage breeding-program ands locations
solgenomics
 
Sl4.0 and ITAG4.0
Sl4.0 and ITAG4.0Sl4.0 and ITAG4.0
Sl4.0 and ITAG4.0
solgenomics
 
Cassavabase-PhenoApps demo ISTRC 2018
Cassavabase-PhenoApps demo ISTRC 2018Cassavabase-PhenoApps demo ISTRC 2018
Cassavabase-PhenoApps demo ISTRC 2018
solgenomics
 
Cassavabase-PhenoApp sample tracking
Cassavabase-PhenoApp sample trackingCassavabase-PhenoApp sample tracking
Cassavabase-PhenoApp sample tracking
solgenomics
 
breeding informatics solutions at SGN
breeding informatics solutions at SGNbreeding informatics solutions at SGN
breeding informatics solutions at SGN
solgenomics
 
Musabase PAG 2018
Musabase PAG 2018Musabase PAG 2018
Musabase PAG 2018
solgenomics
 
Cassavabase workshop ibadan March17
Cassavabase workshop ibadan March17Cassavabase workshop ibadan March17
Cassavabase workshop ibadan March17
solgenomics
 
Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)
Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)
Improvements in the Tomato Reference Genome (SL3.0) and Annotation (ITAG3.0)
solgenomics
 
SolGS Hyderabad conference 2016
SolGS Hyderabad conference 2016SolGS Hyderabad conference 2016
SolGS Hyderabad conference 2016
solgenomics
 
Musa base phenotyping workflow demo
Musa base phenotyping workflow demoMusa base phenotyping workflow demo
Musa base phenotyping workflow demo
solgenomics
 
SolGS workshop 2016
SolGS workshop 2016SolGS workshop 2016
SolGS workshop 2016
solgenomics
 
Cassavabase workshop IITA oct2016
Cassavabase workshop IITA oct2016Cassavabase workshop IITA oct2016
Cassavabase workshop IITA oct2016
solgenomics
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
solgenomics
 
YamBase phenotyping workflow demo
YamBase phenotyping workflow demoYamBase phenotyping workflow demo
YamBase phenotyping workflow demo
solgenomics
 
Introduction to YamBase
Introduction to YamBaseIntroduction to YamBase
Introduction to YamBase
solgenomics
 
Cassavabase general presentation PAG 2016
Cassavabase general presentation PAG 2016Cassavabase general presentation PAG 2016
Cassavabase general presentation PAG 2016
solgenomics
 
Cassavabase SolGS presentation PAG 2016
Cassavabase SolGS presentation PAG 2016Cassavabase SolGS presentation PAG 2016
Cassavabase SolGS presentation PAG 2016
solgenomics
 
Cassavabase SolGS poster PAG 2016
Cassavabase SolGS poster PAG 2016Cassavabase SolGS poster PAG 2016
Cassavabase SolGS poster PAG 2016
solgenomics
 
1 introduction to cassavabase
1  introduction to cassavabase 1  introduction to cassavabase
1 introduction to cassavabase
solgenomics
 
2 Cassavabase workshop: search menu
2  Cassavabase workshop: search menu2  Cassavabase workshop: search menu
2 Cassavabase workshop: search menu
solgenomics
 
3a Cassavabase worksop: manage breeding-program ands locations
3a  Cassavabase worksop: manage breeding-program ands locations3a  Cassavabase worksop: manage breeding-program ands locations
3a Cassavabase worksop: manage breeding-program ands locations
solgenomics
 
Ad

Recently uploaded (20)

Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,PhosphorosClass-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
govindapathak8
 
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptxPreparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Dr Showkat Ahmad Wani
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Polymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer PintPolymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer Pint
Dr Showkat Ahmad Wani
 
Concise Notes on tree and graph data structure
Concise Notes on tree and graph data structureConcise Notes on tree and graph data structure
Concise Notes on tree and graph data structure
YekoyeTigabu2
 
Skin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptxSkin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptx
muralinath2
 
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
muralinath2
 
Zoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptxZoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptx
Dr Showkat Ahmad Wani
 
APES 6.5 Presentation Fossil Fuels .pdf
APES 6.5 Presentation Fossil Fuels   .pdfAPES 6.5 Presentation Fossil Fuels   .pdf
APES 6.5 Presentation Fossil Fuels .pdf
patelereftu
 
Lipids: Classification, Functions, Metabolism, and Dietary Recommendations
Lipids: Classification, Functions, Metabolism, and Dietary RecommendationsLipids: Classification, Functions, Metabolism, and Dietary Recommendations
Lipids: Classification, Functions, Metabolism, and Dietary Recommendations
Sarumathi Murugesan
 
Parallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdfParallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdf
rk5867336912
 
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Yasasi Abeysinghe
 
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptxPresentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
muralinath2
 
Nutritional Diseases in poultry.........
Nutritional Diseases in poultry.........Nutritional Diseases in poultry.........
Nutritional Diseases in poultry.........
Bangladesh Agricultural University,Mymemsingh
 
Antonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of MicrobiologyAntonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of Microbiology
Anoja Kurian
 
Gel Electrophorosis, A Practical Lecture.pptx
Gel Electrophorosis, A Practical Lecture.pptxGel Electrophorosis, A Practical Lecture.pptx
Gel Electrophorosis, A Practical Lecture.pptx
Dr Showkat Ahmad Wani
 
Causes of mortalities of eggs and spawn and remedies.pptx
Causes of mortalities of eggs and spawn and remedies.pptxCauses of mortalities of eggs and spawn and remedies.pptx
Causes of mortalities of eggs and spawn and remedies.pptx
anshumanmohanty9090
 
Keynote presentation at DeepTest Workshop 2025
Keynote presentation at DeepTest Workshop 2025Keynote presentation at DeepTest Workshop 2025
Keynote presentation at DeepTest Workshop 2025
Shiva Nejati
 
Introduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptxIntroduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptx
Nivya George
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,PhosphorosClass-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
govindapathak8
 
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptxPreparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Dr Showkat Ahmad Wani
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Polymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer PintPolymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer Pint
Dr Showkat Ahmad Wani
 
Concise Notes on tree and graph data structure
Concise Notes on tree and graph data structureConcise Notes on tree and graph data structure
Concise Notes on tree and graph data structure
YekoyeTigabu2
 
Skin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptxSkin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptx
muralinath2
 
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
muralinath2
 
Zoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptxZoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptx
Dr Showkat Ahmad Wani
 
APES 6.5 Presentation Fossil Fuels .pdf
APES 6.5 Presentation Fossil Fuels   .pdfAPES 6.5 Presentation Fossil Fuels   .pdf
APES 6.5 Presentation Fossil Fuels .pdf
patelereftu
 
Lipids: Classification, Functions, Metabolism, and Dietary Recommendations
Lipids: Classification, Functions, Metabolism, and Dietary RecommendationsLipids: Classification, Functions, Metabolism, and Dietary Recommendations
Lipids: Classification, Functions, Metabolism, and Dietary Recommendations
Sarumathi Murugesan
 
Parallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdfParallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdf
rk5867336912
 
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Yasasi Abeysinghe
 
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptxPresentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
muralinath2
 
Antonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of MicrobiologyAntonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of Microbiology
Anoja Kurian
 
Gel Electrophorosis, A Practical Lecture.pptx
Gel Electrophorosis, A Practical Lecture.pptxGel Electrophorosis, A Practical Lecture.pptx
Gel Electrophorosis, A Practical Lecture.pptx
Dr Showkat Ahmad Wani
 
Causes of mortalities of eggs and spawn and remedies.pptx
Causes of mortalities of eggs and spawn and remedies.pptxCauses of mortalities of eggs and spawn and remedies.pptx
Causes of mortalities of eggs and spawn and remedies.pptx
anshumanmohanty9090
 
Keynote presentation at DeepTest Workshop 2025
Keynote presentation at DeepTest Workshop 2025Keynote presentation at DeepTest Workshop 2025
Keynote presentation at DeepTest Workshop 2025
Shiva Nejati
 
Introduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptxIntroduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptx
Nivya George
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 

Sql cheat sheet

  • 1. List database, schemas and tables ? show help h SQL syntax help h create table SQL help for create table l list databases c mydb connect to mydb database dn list schemas from a database dt list tables from public schema dt sgn.* list tables from schema sgn d blast_db show blast_db table details o file.txt send output to file q quit psql SQL development commands CREATE DATABASE mydb; ALTER DATABASE mydb RENAME TO newname; DROP DATABASE mydb; CREATE TABLE mytable (col_name type constraints); ALTER TABLE mytable RENAME TO newname; DROP TABLE mytable CASCADE; ALTER TABLE mytable ADD COLUMN column_name column_type; ALTER TABLE mytable RENAME COLUMN column_name TO newname; ALTER TABLE mytable DROP COLUMN column_name RESTRICT; INSERT INTO mytable (column1,column2) VALUES (‘value1’,’value2’); UPDATE mytable SET column1=‘value1’ WHERE column=value; DELETE FROM mytable WHERE column=‘value’; BEGIN; command; COMMIT; BEGIN; command; ROLLBACK; PostgreSQL Cheat Sheet BTI-SGN Databases Course 2016 SQL query commands SELECT * FROM mytable; SELECT mycolumn FROM mytable; SELECT … WHERE mycolumn=‘value1’; SELECT DISTINCT mycolumn FROM mytable; SELECT COUNT(*) FROM mytable; SELECT … ORDER BY mycolumn; SELECT … WHERE mycolumn IN (1,2); SELECT … WHERE mycolumn LIKE ‘%Abc%’; SELECT … WHERE mycolumn ILIKE ‘%abc%’; SELECT … WHERE mycolumn IS NULL; SELECT … LIMIT 10; SELECT … OFFSET 10; SELECT … JOIN mytable USING(common_column); SELECT … JOIN mytable ON(common_column1=common_column2);