Wednesday, January 1, 2020

SQL(Standard Query Language)

SQL 

SQL stands for the Structured Query Language. SQL is a standard query language used for maintaining the relational database and perform many different operations of data manipulation on the data. SQL initially was invented in 1970. It is a database language used for database creation, deletion, fetching rows and modifying rows, etc. sometimes it is pronounced as 'sequel.'

What is usage of SQL?? 

(1)SQL is responsible for maintaining the relational data and the data structures present in the database.
(2)To execute queries against a database.
(3)To retrieve data from a database.
(4)To inserts records in a database.
(5)To updates records in a database.
(6)To delete records from a database.
(7)To create new databases.
(8)To create new tables in a database.
(9)To create views in a database.
(10)To perform complex operations on the database.

What is Data??

Data is a collection of a distinct small unit of information. It can be used in a variety of forms like text, numbers, media, bytes, etc. it can be stored in pieces of paper or electronic memory, etc.Word 'Data' is originated from the word 'datum' that means 'single piece of information.' It is plural of the word datum.In computing, Data is information that can be translated into a form for efficient movement and processing. Data is interchangeable.

What is DataBase??

A database is an organized collection of data, so that it can be easily accessed and managed.You can organized data into tables,rows,columns,and index it to make it easier to find relevant information.There are many databases available like MySQL,Sybase,Oracle,MongoDB,Informix,PostgresSQl,SQL Server ,etc.

SQL or Structured Query Language is used to operate on the data stored in a database.SQL depends  on relational algebra and tuple relational calculus.

What is RDBMS??

RDBMS stands for Relational Database Management Systems.All modern database management systems like SQL, MS SQL Server, IBM DB2,ORACLE , My-SQL and Microsoft Access are based on RDBMS. It is called Relational Date Base Management(RDBMS) because it is based on relational model introduced by E.F.Codd.

SQL statement

SQL statements are started with any of the SQL commands/keywords like SELECT, INSERT, UPDATE, DELETE, ALTER, DROP etc. and the statement ends with a semicolon (;).
Example of SQL statement:
SELECT"column-name" FROM"table-name";

Why Semicolon is used after SQL statements:

Semicolon is used to separate SQL statements. It is a standard way to separate SQL Statements in a database system in which more than one SQL statements are used in the same call.

SQL Commands

There are the some important SQL command:
SELECT:It extracts data from a database.
UPDATE:It update data from a database.
DELETE:It deletes data from database.
CREATE TABLE:It creates a new table.
ALTER TABLE:It is used to modify the table.
DROP TABLE:It deletes a table.
CREATE DATABASE: It creates a new database.
ALTER DATABASE:It is used to modify a database.
INSERT INTO:It inserts new data into a database.
CREATE INDEX:It is used to create an index(search key).
DROP INDEX:It deletes an index.

SQL OPERATORS
(1)Arithmetic Operators 
(a)"+"->It is used to add containing values of both values.(a+b)
(b)"-"->It subtracts right hand operand from left hand operand.(a-b)
(c)"*"->It multiply both operand's values.(a*b)
(d)"/"->It divides left hand operand by right hand operand.(a/b)
(e)"%"->It divides left hand operand by right hand operand and returns reminder.(a%b)

(2)Comparison Operators
(a)"="->Examine both operands value that are equal or not,if yes condition become true.(a=b)
(b)"!="->This is used to check the value of both operands equal or not,if not condition become true.(a!=b)
(c)"<>"->Examines the operand's value equal or not, if values are not equal condition is true.(a<>b)
(d)">"->Examine the left operand value is greater than right Operand, if yes condition becomes true.(a>b)
(e)"<"->Examines the left operand the left operand value is less than right operand,if yes condition becomes true.(a<b)
(f)">="->Examines that the value of left operand is greater than or equal to the value of right operand or not,if yes condition become true.(a>=b)
(g)"<="->Examines that the values of left operand is less than or equal to the value of right operand or not,if yes condition becomes true.(a<=b)
(h)"!<"->Examines that the left operand value is not less than the right operand value.(a!<b)
(i)"!>"->Examines that the values of left operand is not operand is not greater than the value of right operand.(a!>)

(3)SQL Logical Operators
(a)ALL->This is used to compare a value to all values in another value set.
(b)AND->This operators allows the existence of multiple conditions in an SQL statement.
(c)ANY ->This operators is used to compare the value in list according to the conditions.
(d)BETWEEN->This operators is used to search for values,that are within a set of values. 
(e)IN->This operators is used to compare a value to that specified list value.
(f)NOT->The NOT operator reverse the meaning of any logical operator.
(g)OR ->This operator is used to combine multiple conditions in SQL statements.
(h)EXISTS->The EXISTS operator is used to search for the presence of a row in a specified table.
(i)LIKE->This  operator is used to compare a value to similar values wildcard operator.


SQL KEYS

(1)Primary Key->A column or columns is called Primary Key(PK) that uniquely identifies each roe in the table.When columns are used as a primary key,it is known as composite primary key.
(2)Foreign Key->In the relational databases,a foreign key is a field or a column that is used to establish a link between two tables.In simple words you can say that, a foreign key in one table used to point primary key in another table.
(3)Composite Key->A composite key is a combination of two or more columns in a table that can be used to uniquely identify each row in the table when the columns are combined uniqueness is guaranteed, but when it taken individually it does not guarantee uniqueness.
(4)Unique Key->A unique key is a set of one or more than one fields/columns of a table that uniquely identify a record in a database table.
(5)Alternate Key->Alternate key is a secondary key it can be simple to understand by an example:-Let's take an example of student it can contain NAME, ROLL NO., ID and CLASS.Here ROLL NO. is primary key and rest of all columns like NAME, ID and CLASS are alternate keys.



 




No comments:

Post a Comment

Detail of Software and Hardware

  Topic   There are available only two things in computer system one is software and another is hardware.   Both is opposite of each other...