Back to SQL Course

SQL Course

What is SQL?

SQL is Structured Query Language designed for inserting and modifying in a relational database management system.

What are the Advantages of SQL?

  • SQL is not a proprietary language used by specific database vendors. Almost every major DBMS supports SQL, so learning this one language will enable programmer to interact with any database like ORACLE, SQL ,MYSQL etc.
  • SQL is easy to learn. The statements are all made up of descriptive English words, and there aren't that many of them.
  • SQL is actually a very powerful language and by using its language elements you can perform very complex and sophisticated database operations.

Creating a database in MySQL

create database praveensampledb;

Using the created database

use praveenempdb;

Creating a table in MYSQL

CREATE TABLE EMPLOYEE ( ID bigint auto_increment, NAME varchar(100) NOT NULL, AGE int NOT NULL, EMAIL varchar(100) NOT NULL, ADDRESS varchar(100) NOT NULL, DESIGNATION varchar(100) NOT NULL, PRIMARY KEY (ID) );

Inserting a row into a MySQL table

INSERT INTO EMPLOYEE(NAME,AGE,EMAIL,ADDRESS,DESIGNATION) VALUES ("Praveen", 36, "praveenoruganti@gmail.com","Hyderabad","Educator");

Updating a row into a MySQL table

UPDATE EMPLOYEE set DESIGNATION="Full Stack Developer" where ID=1;

Deleting a row into a MySQL table

DELETE FROM EMPLOYEE Where ID=1;

Selecting rows based on conditions in MySQL

SELECT * FROM EMPLOYEE Where NAME="Praveen";

Show list of existing databases

SHOW databases;

Show tables in an existing database

SHOW tables;

Show all the fields of a table

DESC EMPLOYEE;

Processlist

SELECT ID, USER, HOST, DB, COMMAND, TIME as time_seconds, ROUND(TIME / 60, 2) as time_minutes, ROUND(TIME / 60 / 60, 2) as time_hours, STATE, INFO FROM information_schema.PROCESSLIST ORDER BY INFO DESC, TIME DESC;

SQL Mindmap

screenshot of the app