Posts

Showing posts from October, 2015

SQL Basic- Important thing Keep Mind it....

Image
Important thing Keep Mind it....  Important Thing Some database systems require a semicolon at the end of each SQL statement. Semicolon is the standard way to separate each SQL statement in database systems that allow more than one SQL statement to be executed in the same call to the server. Important SQL Commands Command              Description SELECT              Show data from a database INSERT              Insert new data into a database UPDATE              Update data in a database DELETE              Delete data from a database CREATE DATABASE              Create a new database ALTER DATABASE              Modifies a database ...

SQL Basic- SQL Syntax

Image
          SQL Syntax:            SQL Syntax Database Tables A database contains one or more tables. Each table is identified by a name (e.g. "Student" or "Product").  Tables contain records (rows) with data. Below is a selection from the " Student " table: StudentID             StudentName               Address                Country 1             Ajay               Noida                India 2             Ajeet               Bareilly                India 3             Shivam               Nagaland...

SQL Server: SQL Basic- SQL Commands(DDL,DML,DCL)

SQL Server: SQL Basic- SQL Commands(DDL,DML,DCL) : SQL commands based on their nature: These commands can be classified into groups based on their nature: DDL Commands (Data D...

SQL Basic- SQL Commands(DDL,DML,DCL)

Image
SQL commands based on their nature: These commands can be classified into groups based on their nature: DDL Commands (Data Definition Language) CREATE Creates a new table or other object in database. ALTER Modifies an existing database object. DROP Deletes an entire table or other object in the database. DML Commands (Data Manipulation Language) SELECT Retrieves records from one or more tables. INSERT Insert a record into the table. UPDATE Modifies records. DELETE Deletes records. DCL Commands (Data Control Language) GRANT         Gives a privilege to user. REVOKE           Takes back privileges granted from user.

SQL Basic- SQL Commands

Image
          SQL Commands                       The SQL commands to interact with relational databases are: CREATE,  SELECT,  INSERT,  UPDATE,  DELETE and  DROP.               These commands can be classified into groups based on their nature:           DDL - Data Definition Language.            DML - Data Manipulation Language.            DCL - Data Control Language.

RESET identity Columns in SQL Server

Image
Introduction: During application development, we input dummy data into database for testing purposes. But then we come to the point where we want all records of the table to be deleted and also want to start the identity column values from 0. For this, we delete existing data using the  Truncate  command. This will delete  data from table and also reset the identity column value to  0 . Solution: Truncate table [table_name]    for example:           Truncate table ColonyName But the  Truncate  command fails to delete the data if there is a relationship given to the table and the identity column is not reset. In this case, first you need to delete data from the child and the master table . After that, execute this command and it will reset your identity column to 0. DBCC CHECKIDENT('[table_name]', RESEED, [new_reseed_value]) -- for example DBCC CHECKIDENT(' ColonyName ', RESEED, 0) Note: In...