Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

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...

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.     ...

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...

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...

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 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 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...

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...

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. ...

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 ...

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...

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...

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...

SQL Server : Global Variables

SQL Server provides a number of global variables, which are very useful.The values of these variables is maintained by the server. All the global variables represent information specific to the server or a current user session.The names of global...

SQL Server : How to Enable or Disable All the Triggers on a Table and Database?

Sometimes we need to disable trigger on a table especially when performing admin tasks on a table. Following commands provide a quick way to disable all the triggers for a table. Please note that when we are diabling triggers on a table we w...

SQL Server : How to do case sensitive search?

Sometimes during application development we need to do case sensitive search. Let us see how we can do the same in SQL Server. For illustration purpose we will use a table called Technology which has a column named Platform.Now let us say colu...

NORMALIZATION IN DBMS

NORMALIZATION Database is a collection of meaningful data by which we can easily upload,update,delete and manage data. while creating a database the main problem which encounter is data redundancy. Data redundancy is condition in which same ...

SQL : How to update top N records in a table?

It is a common requirement in SQL server development to update top N records in SQL server.In this blog we will see two approaches to accomplish the same. 1) Using UPDATE with TOP UPDATE TOP (100) Table1 SET field1 = 1 However witho...

SQL Server : Error handling using TRY-CATCH

Before SQL Server 2005, the only practical way to trap errors in SQL was using the old-fashioned @@error system variable. Although this is still supported, in this blog we will learn how to use TRY-CATCH for handling errors.TRY-CATCH block is si...

SQL Server Transactions

A Transaction groups a set of tasks into a single execution unit. Each transaction begins with a specific task and ends when all the tasks in the group successfully finish.If all of these tasks execute successfully, then a transaction is committe...

Change the datatype of a column in SQL Server

Hello Reader!If you wish to add, delete or modify columns in an existing table you can do this with the help of ALTER command. The syntax to change or we can say to modify a column in an existing table in SQL server is: ALTER TABLE table-na...

SQL LIKE Clause

The SQL like clause is used to look for the values which are similar to the values in the table with the help of wildcard operators. We have two types of wildcard operators: 1. "% - percent sign 2. _- underscore Syntax: SELEC...

Combining Results of two or more SELECT Statements

Combining Results of two or SELECT Statements using UNION OPERATOR: UNION Operator is used to combine the results of two or more SELECT statements. But UNION operator does not return duplicate rows so to return duplicate rows UNION ALL operato...

SQL: Difference between inner join and outer join

Joins are used to combine the data from two tables and return specific rows of data from the tables. A join can be either an inner join or an outer join, depending on what is expected in the result. INNER JOIN: Gets all matching rows i...

what is the use of FORMAT() function in SQL?

In SQL, FORMAT() function is used to format a column value means how a field will to be displayed. FORMAT() Syntax SELECT FORMAT(column_name,format) FROM table_name; In the above syntax parameters are as below: Parameter Descri...

what is the use of NOW() function in SQL?

In SQL, NOW() function is used to return the current system date and time. NOW() Syntax SELECT NOW() FROM table_name; We have a table "employee" as below: employee id first_name last_name salary ........

SQL Tutorial -> Sql Inner Join

<-- Chapter 25: SQL Join Chapter 26 SQL Inner Join SQL Inner Join clause is used to fetch all the rows from more than two tables in which there is a match between the columns. Inner Join is similar like Join clause. Lets see an ...

SQL Tutorial -> Sql Joins

<-- Chapter 24: SQL Aliases Chapter 25 SQL Joins SQL Joins clause are used to combine data rows from two or more than two tables according to common field values between them. Lets see an examples from the below tables "customer...

SQL: WHERE ,AND and OR Clause

1. SQL WHERE Clause:- SQL WHERE Clause is one of the most useful feature of the SQL query as it is used to specify a condition while fetching the data from single table or joining with multiple tables,it also allows you to select specific ...

SQL Tutorial -> Sql Wildcards

<-- Chapter 22: SQL Select Top Chapter 23 SQL Wildcards SQL Wildcard characters are used to substitute any characters in a string. As we have discussed LIKE operator in chapter 10. SQL supports two wildcard operators with LIKE opera...

ALIAS Keyword

ALIAS Keyword: It is used to give temporary names to table and columns. It is very useful for situations where column or table names are too long. Synatx: SELECT columnname AS alias&#95;name FROM tablename; This syntax is used ...

SQL Tutorial -> Sql Injection

<-- Chapter 20: SQL DELETE Chapter 21 SQL INJECTION SQL Injection is an injection attack wherein attacker is able to submit a database SQL command which is executed by a web application exposing back-end database. Attacker can add SQL ...
prev 1
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: