Switch case (INSERT)

 


KILL ALL EXISTING CONNECTION FROM DB – PostgreSQL

 



Backup & Restore Database in PostgreSQL

1) Backup data with pg_dump

To list all of the available options of pg_dump , please issue following command.

pg_dump -?

  • -p, –port=PORT database server port number
  • -i, –ignore-version proceed even when server version mismatches
  • -h, –host=HOSTNAME database server host or socket directory
  • -U, –username=NAME connect as specified database user
  • -W, –password force password prompt

How to Back Up and Restore a MySQL Database

If you’re storing anything in MySQL databases that you do not want to lose, it is very important to make regular backups of your data to protect it from loss. This tutorial will show you two easy ways to backup and restore the data in your MySQL database. You can also


MySql Login, Database & User Creation

Step 1: Login to MySQL ( you will need an account )

Enter password:- Enter your mysql password

Step 2: Create the Database

Step 3: Verify that it’s there

Step 4: Create the User

Example:- CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'password123';

Step 5: Grant privileges while assigning the password


Example:- GRANT ALL

Concatenate multiple MySQL rows into one field

 


SQL Introduction

SQL is a database computer language designed for the retrieval and management of data in relational database. SQL stands for Structured Query Language.

SQL

  1. Allows users to access data in relational database management systems.
  2. Allows users to describe the data.
  3. Allows users to define the data in database and manipulate that data.
  4. Allows to embed

MySQL Search and Replace Query

 


UPDATE query based on SELECT Query

MySQL update join syntax:

ANSI SQL syntax:

or