What is SQL?
SQL stands for Structured Query Language.Standard language for relational database management systems.SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.What is RDBMS?RDBMS stands for Relational Database Management System. RDBMS data is structured in database tables, fields and records. Each RDBMS table consists of database tablerows. Each database table row consists of…
SQL Command – Aggregate Functions
• AVG (): Average of the column. • COUNT (): Number of records. • MAX(): Maximum of the column. •MIN(): Minimum of the column. • SUM(): Sum of the column. Another arithmetic function is COUNT. This allows us to COUNT up the number of row in a certain table. The syntax is, SELECT COUNT(“column_name”)FROM “table_name“…
SQL Command – CONCAT, TRIM, Like
TRIM: TRIM()- TRIM function in SQL is used to remove specified prefix or suffix from a string. LTRIM(str): Removes all white spaces from the beginning of the string. SELECT LTRIM(‘ Sample ‘); RTRIM(str): Removes all white spaces at the end of the string. SELECT RTRIM(‘ Sample ‘); CONCAT*Sometimes it is necessary to combine together (concatenate) the results from several…
SQL Command – insert Into, Delete, Update
Insert Into Command:Insert Into Command adds rows to an existing table.* INSERT INTO <Table_Name> (Column1, Column2, Column3…) VALUES (Value1, Value2, Value3…)*i.e. INSERT INTO Customers (FirstName, LastName, DOB, Phone) VALUES (‘Peter’, ‘Jack’, ‘1/12/1974’, ‘444 888-8888’); Update Command:Update Command modifies a set of existing table rows. UPDATE Table1SET Column1 = Value1,*Column2 = Value2WHERE Column_Name = Value*i.e.*UPDATE EmployeeSET…
SQL – Clause Group By, Having and Order By Command
Group By Clause:Group By clause is used to display rows having common values into a smaller set of rows. GROUP BY is often used in conjunction with SQL aggregation functions or to eliminate duplicate rows from a result set. SELECT Employee, SUM (Hours)FROM EmployeeHoursGROUP BY Employee Having Clause: Having clause includes a predicate used to…
SQL – Create, Alter, Drop Command
Create: Create Command -Creates a table in the database. CREATE TABLE<Table Name> (Column_Name1 Datatype(Size), Column_Name2 Datatype(Size) …); i.e. CREATE TABLE employees ( Employee_id INTEGER PRIMARY KEY, First_Name CHAR(20), Last_name CHAR(25), Dept CHAR(15)); Alter Command: Alter Table command modifies the structure of an existing Table adding or Droping the column or a constraint, e.g.,: To Add…
Categories of SQL Commands
Categories of SQL Commands 1.Data definition language Statements: A Data Definition Language or Data Description Language (DDL) is a Computer language for defining Data Structures. Set of SQL commands used to Create, modify and Delete database structures.Commands like Create,Alter and Drop 2, Data manipulation language (DML) statements: Data Manipulation Language (DML) is a Set of SQL commands used to insert, delete and…
Follow My Blog
Get new content delivered directly to your inbox.