job post without registration

Comments · 415 Views

Jobisite is the best place to find jobs in USA and abroad. Search IT Jobs, Banking jobs, Insurance Jobs, Software jobs through our Job portal.

SQL : SQL stands for Structured Query Language and it allows us to access and update databases.

In this topic we will discuss very basic sql commands with simple syntaxes.

 

How to create table:
Use command “ Create Table TableName ( columnName type, columnName type) ; ”

Example :


CREATE TABLE fashion (
Jwellery INT PRIMARY KEY,
clothes VARCHAR (5),
bagsbrand VARCHAR (5)
);

 

How to delete table:
Use command “ Delete from tableName ”

Example :

Delete from Fashion ;
How to insert data into table:
Use command “ Insert into table name (columns: 1,2,…so on), Values( value 1,2…so on)”

Example :

INSERT INTO food (vegetables, fruits, dessert) VALUES ('cabbage' , 'apple' , 1)
INSERT INTO food (vegetables, fruits) VALUES ('cabbage' , 'apple' ) // if we have to insert into few columns

How to Update in table:
Use command “ Update Tablename Set columns= values where conditions =”

Example :

UPDATE food SET fruits='Orange' WHERE dessert=1
How to Select data from table:
Use command “ Select * from Table name”

Use command “ Select columnName1,columnName2 from Table name”

Example :

SELECT * from food
SELECT vegetables, dessert FROM food
Select data with ordering:
Use command “ Select Table (column) from Table name Order by (column name ) Desc/Asc”

Example :

SELECT food.vegetables FROM food ORDER BY vegetables DESC;
How to Join tables:
Use command “ Select table1Alias.columnName , table2alias.columnName from table1 table1Alias
Inner Join table2 table2alias
on table1Alias.commonColumnName = table2alias. commonColumnName”

In join, we actually combine two tables data based on one similar column in both tables.

Example :

SELECT * FROM Person p INNER JOIN jobposting j
ON p.ID = j.EMPLOYEEID
How to Union tables:
Use command “ Select column from table 1
union
select column from table 2”

Here we combine the resultset of first sql query/table with the resultset of second sql query/table

The number/name of columns should be same.

 

Example :

SELECT jb.id as ID FROM jobposting jb
UNION
select p.id as ID FROM Person p

 

Frequently asked questions :

What is RDBMS?

RDBMS stands for Relational Database Management System. Here the data is stored in multiple tables which can have relations also.
Some of the known RDBMS are : Mysql , MSSQL ,DB2 , Oracle.

What is the difference between DDL and DML?

DDL ( Data Definition Language ) and is used to define the structures like schema, tables, constraints etc.
Examples of DDL are create ,alter, drop statements.
However,DML ( Data Manipulation Language) and is used to manipulate data. For example : insert, update and delete statements.

What are some major sql constraints?
Below are major constraints in sql:
NOT NULL: Means the columns needs some value. It will throw error if one tries to insert into this table without any value for the column having this constraint.
UNIQUE: The column can have unique values only.
PRIMARY KEY: NOT NULL and UNIQUE values.
FOREIGN KEY: It is used to ensure the referential integrity of data in the table. It matches the value in one table with another using the PRIMARY KEY.
CHECK: It ensures whether the value in columns fulfills the specified condition.

What are the different joins?
INNER JOIN: This join returns all rows from both tables when it has at least one matching column.
LEFT JOIN (LEFT OUTER JOIN): This join returns all rows from the LEFT table and its matched rows from a RIGHT table.
RIGHT JOIN (RIGHT OUTER JOIN): This joins returns all rows from the RIGHT table and its matched rows from the LEFT table.
FULL JOIN (FULL OUTER JOIN): This joins returns all results when there is a match either in the RIGHT table or in the LEFT table.

What is the difference between WHERE and HAVING clause in SQL?

The main difference between WHERE and HAVING clause comes when used together with GROUP BY clause.
‘where’ clause is used before grouping of the data and ‘having’ is used after grouping of the data.

visit multiple job board posting

Comments