Category Archives: Database Tutorial
The left Join of SQL The left join is the type of join that returns all rows from the left table (the table in the select from) whereas only matched rows from the other table are retrieved. An example of left join As it returns all rows from the first table/left table, the column values for
How to create a database In order to work with relational databases, the first thing to do is to create SQL database in the database server of your choice. Whether you are working on the MS SQL server, MySQL database, Oracle etc. you need to ensure that you have the sufficient privileges to create a database
SQL Aggregate functions The SQL comes up with many aggregate functions that allow you to perform calculations on the columns data and return the aggregated value. These SQL aggregate functions can work in the simple SQL select statement or with the group by clause in the select statement to return single or group based calculated
What is primary key in SQL In the last chapter of how to create SQL table, we learned how to create tbl_employee table in our test_db database. We created a table with four columns: emp_name, emp_age, emp_salary, and joining_date. Now, what if two employees with the same names join on the same date? Or there may be scenarios where similar
The delete statement A few main points by the delete command are: The delete statement of SQL is used to remove data from tables of the database. The delete statement removes existing data from the tables. With a single delete query in SQL, you can remove whole data, a single row or multiple rows from
The min() function returns the minimum or lowest value in the given column.
You can use min function in a simple select statement.
Syntax of SQL between operator The general syntax of the between logical operator is: Select * from table_name Where col_name BETWEEN val1 AND val2 Where val1 and val2 can be two numbers, characters or dates. See a between example Between with dates example The Between operator A few main points about the SQL Between operator
How to use the SQL Avg function? The general syntax of using SQL average function is: Select avg(numeric_column_name) from table_name Where col_name = value See an example of AVG function A few points about the Avg function The Avg() returns the average value of the given numeric column. You can use the Avg function in the
If you have a list of values to match in order to fetch rows from a database table, this is where the IN SQL operator works.
The IN is a logical operator that takes a list of values to be matched to return records.
What is the max function? The max() function of SQL returns the maximum value in a given column. You can use the Max function in the simple select statement. You can also use the SQL max aggregate function with the group by clause to return maximum values in consolidated data. An example of Sum function Syntax of