Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
What makes SQL servers have really slow response times
Troubleshooting SQL server performance can be tricky if you are not familiar with the kinds of issues that can commonly crop up in this operating environment.
Thankfully plenty of other people have encountered and tackled the problem...
Cursor in SQL Server
A cursor is a database object that can be created at runtime. It is used to get data from a result set line by line(or row by row) rather than executing all the rows in the result set at a single time like an SQL-transaction. Generall...
SQL Server : How to find a stored procedure containing specific text
Many times during SQL server development we need to search for a stored procedure containing a specific text. This helps in checking for dependencies for objects in stored procedures or sometimes we might be simply interested in searching for a h...
Pagination stored procedure in SQL Server
In this blog we illustrate how to get the pagination data from SQL server stored procedure.
To create a such type of a stored procedure, we need to send a minimum three parameters(startRowIndex, pageSize, totalCount).
1. ...
Triggers in the SQL server
A trigger is a unique store procedure that is executes to give a response to particular action on the table of a database using the following SQL statements:
1. Data Manipulation Language (DML) SQL Statements (like INSERT, UPDATE or DE...
SQL Server : List all trigger associated with a table with SQL Server
During management of SQL server database many times we need to get list all triggers in SQL Server database with table name and table's schema . Following query can be used to get the desired result.
SELECT
sysobjects....
Difference between TRUNCATE, DELETE commands
TRUNCATE:
Truncate command will remove all the rows from a table, there will be no WHERE clause in TRUNCATE command and there will be no data in the table after we run the truncate command.
...
How to use IN keyword in LINQ
In SQL Server, we are very familiar with IN keyword and we use this keyword in many times which is very helpful for us. It save our extra efforts and code line like below query.
To achieve this in LINQ , we heve below t...
SQL Injection
SQL Injection
Security of any Application plays a major role for any developer. Some of the users try to break the security of any application for their fun, for stealing the data .They use different methods to break the security and SQL Injec...
Different Types of SQL Keys
SQL Keys play a very important role in database related task in SQL like retrieve data/record from the table according to the requirement. A key can be defined as a single or combination of multiple fields/columns in a table. With the help ...
SQL Inbuilt Functions
Hi Readers,
In this blog, we will discuss the inbuilt functions of SQL which are used to perform calculations on data. All inbuilt functions are provided to make the task easier to do and we can easily complete a complex task with the help...
Best practices for error handling and logging
In this blog I have summarized the best practices for error handling and logging.
1) Appropriate use of try/catch.
2) Log sufficient contextual information. All exceptions are logged(with userid , page or proc name, timestamps ,inner except...
SQL Server : Best Practices
Following is a list of best practices for SQL Server
1) Use correct formatting
Following is a sample select query for reference:
SELECT
X.column...
Except Clause in SQL
Except Clause:
It combines two select statements and return tuples from first SELECT statement which are not returned by second SELECT statement. It is used to achieve Distinct and Not In queries operation in a single clause(Except).
S...
Difference between reset and drop in rails
We often use rake db:reset command for recreating the database, instead of conventional 3-steps for doing the same.
rake db:drop (dropping the Database, wipe away all your data)
rake db:create (Create the Database)
rake db:migrate (Runs...
How to insert value in an auto incremented column in SQL
How to insert value in an auto incremented column in SQL
Sometimes we have situation to insert value in an auto incremented column. Let's discuss this with a simple example.
Example
1) Here is my table structure.
CREATE TABLE St...
How to use SQL Min () Function ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use SQL Min () Function in Sql.
SQL Min () Function is used for getting the minimum value from the selected field.
Syntax of SQL Min ():
se...
MySQL CONCAT Functions
CONCAT function is mysql plays a vital role. The CONCAT() function combine or concatenate the list of strings together .
We have 2 types of concat function ->
CONCAT() – This function will concate list of string together without...
How to update increment value in a table without loop in SQL
Hi All,
Some time we need to update value in a table in some pattern or increment order. Then we use loop and iterate with all record, but as know looping is take time and our application become slower.
We can achieve this by without loop a...
How to use Sql Avg () Function ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use Sql Avg () Function in Sql ?
So, basically this function is used for returning the average of numeric column.If in a table there is null value t...
How to use SQL Max () Function ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use SQL Max ( ) Function in Sql ?
Basically, SQL Max () Function is used to get the maximum value from the selected field.
&nb...
INTERSECT Clause
INTERSECT Clause:
It works similar like union clause as it is used to combine two SELECT statements, but it returns tuples only from first SELECT statement which are common to tuples in the second SELECT statement.
Syntax:
S...
How to trace SQL query or SP on a page
HI Guys,
Some times we want to know that what SQL operation is running on a particular page or a event, then we have to debug our code base and we get the result, but it's time taking process to debug code line by line and as well as some ...
How to limit data in MYSQL
The LIMIT clause in MySQL helps to get multi pages results or pagination through SQL Databases. This LIMIT clause is very useful on large tables its because returning the large numbers of records through MYSQL will be difficult to read and analyz...
Subquery
A subquery is a query within a query embedded within where clause
It is used to return the data that will be used in the main query as a condition to the data that is retrieved.
SELECT, INSERT, UPDATE, and DELETE statements along with the o...
DECODE function
DECODE function:
DECODE function works similar to if-else statement or case statement. DECODE compares expression to each search value one by one and returns the result of that search which is equal to the expression. If there is no match than...
Check Constraint
Check Constraint:
It is used to restrict the range of values that can be inserted in a column. If a column contain check constraint then only a particular range of values can be inserted in that column.
Example:
CREATE TABLE Employee(
...
Query Languages
1. QUEL
It is the query language in the system INGRES. It is based on relational calculus. The fundamental aspect of the query languages based on the relational calculus is tuple variable ( which is a variable that "ranges over&...
Adding multiple rows with a single Insert Statement
INSERT ALL Statement:
With the help of INSERT ALL statement we can add multiple rows with a single INSERT statement. We can use this statement to insert multiple rows in one or more than one tables. It eliminates the need of writing insert sta...
Difference between DELETE and TRUNCATE commands?
Delete command in SQL removes the ROW based on the condition provided with the WHERE clause, if no WHERE clause is provided it deletes all the row from the table.
Syntax for delete command:
DELETE FROM table_name WHERE column_name='value'...
How to select second highest salary from a table?
This question is asked a lot in interviews, so here some of the methods by which one can get the second highest salary of an employee from a table.
Suppose the Employee is like this
ID
Name
Salary
Table: Employe...
Temporary tables
MySQL Temporary tables:
A temporary table allows a user to store temporary records and we can use these records several times until the session does not expire. They are useful in those situations when it is expensive to write a query havin...
EXISTS Operator
EXISTS Operator:
Exists operator is a special type of operator which is used in a subquery. It is used to check whether a subquery returns something or not. If a subquery returns some row then outer query get executed otherwise the whole query...
SELECT INTO Statement
SELECT INTO Statement:
SELECT INTO statement is used to copy data from one table into another table. We can provide a condition while using SELECT INTO statement.
Syntax:
SELECT columnname(s)
INTO new_tablename
FROM t...
NOT operator in SQL
NOT Operator:
The SQL NOT operator is used to reverse a condition in a SQL query. It is used with SELECT, DELETE, UPDATE, or INSERT statement. It can be used with other operators like BETWEEN, IN , EXISTS but it will reverse the condition.
...
BETWEEN and NOT BETWEEN Operator
BETWEEN Operator:
It is used to fetch values which lies within a range given in BETWEEN operator.
Syntax:
SELECT columnname(s)
FROM tablename
WHERE columnname BETWEEN value1 AND value2;
Example:
SELECT * FROM Employee
WHERE ...
Case Expression in SQL
Case Statement:
Case Statement is used to provide IF-ELSE functionality in a SQL query to fetch result. We provide multiple conditions and according to condition matches the value will change for that that column value.
Syntax:
SELECT ...
SQL COMMANDS
SQL is Structure Query Language which is developed by E.F.Codd.Today almost all Relational Database Management Systems (RDBMS) uses SQL as the standard database language. We can use it to do different types of operations in RDBMS.
SQL COMMAND...
Use of AVG() Function in MySql
The MySql provides us with various for wide use for handling the database. The AVG() function is also one of the important function used in MySql. The AVG() is used to calculate the average value of the columns.
Syntax:
SELECT AVG(column-n...
TOP Clause in SQL
SELECT TOP clause:
TOP clause is used to fetch specific
number of records from a table.
This clause is very handy when we
have huge table of thousands of
record in it . And fetching data
from these tables are quite
time-consuming , in ...
Dual Table
Dual table:
DUAL table is a dummy table which
contains one row and one column and
by default it is present in
database.It contains a single
VARCHAR2(1) column known as DUMMY
with a value "X".
It can be accessed by all users but
the ...
FULL OUTER JOIN IN SQL
FULL OUTER JOIN
If you want to combine the results of both LEFT and RIGHT join than we use FULL JOIN keyword. The joined table which created after FULL JOIN contains all records from both the two tables, and fills null value for those places...
How to use Right Join on two tables
Right Join:
Right Join is used to join two tables and it return all rows from right table(table 2) and matching rows from table 1(left table). The result is NULL for unmatched rows for table 1(left table). Right Join keyword is used to apply R...
Aggregate Functions
Aggregate Functions:
Oracle has many built-in functions which are used to process numbers or strings. They are very useful as we can directly use them , we just have to write the aggregate function name and in braces the column name on which w...
SQL CONSTRAINTS
SQL CONSTRAINTS
A constraint is a rule or limitation that we place on the data in a database that we can put into a column(s). A constraint is part of the table. we can apply constraints when we create the table or afterwards. Constraints coul...
How to use Left Join
Left Join:
Left Join is used to join two tables and it return all rows from table 1 and matching rows from table 2. The result is NULL for unmatched rows for table 2. Left Join keyword is used to apply Left Join on two tables.
Syntax for Le...
FOREIGN KEY
FOREIGN KEY
Foreign key is used to setup relation between two tables in a database. A foreign key is a values that appear in both the tables in database system.
The table which contain foreign key is called the child table while the table to...
UNION CLAUSE IN SQL
UNION CLAUSE
The union operator in sql is used to combined two different queries into a singel table.
For eg:-we have one table which have information about employee, also have another table that have information about their department, and t...
SQL Server : Read only databases
Databases whose data is not required to be changed should be considered to be set as READ ONLY.Databases can be set to READ ONLY mode and back using T-SQL and SSMS.
Following are the scripts that can be used to set database read only and bac...
SQL Server : Useful datetime functions to find specific dates
Following are some useful SQL Server Date functions to find specific dates.
1) Today
SELECT GETDATE() 'Today'
2) Yesterday
SELECT DATEADD(d,-1,GETDATE()) 'Yesterday'
3) First Day of Current Week
SELECT DATEADD(wk,DATEDIFF(wk...