MVC

  • Home
  • HTML
    • Overview
    • Formatting
  • Java Script
    • Overview
    • Validation
  • CSS
    • Overview
  • Sql
    • Overview
    • SQL Select
    • SQL Command
    • Advance Query
    • SQL Create
    • Function
    • Function vs StoreProcedure
    • Stored Procedures
  • MVC
    • OverView
    • Evolution of MVC
    • Install VisualStudio-2015
    • Create First Application
  • LINQ
    • Introduction
  • Privacy Policy

Sunday, 1 October 2017

Sql Commands

  Unknown       05:11       SqlCommand       No comments    

Sql Select Query

SQL Select all data from Table as you can see in my previous Article
http://learningmvctutorial.blogspot.in/2017/03/sql-select.html

Insert Query

In SQL Server you can use Insert data in table help of Insert Query
Syntax
INSERT INTO TableName(ColumnName1,ColumnName2,ColumnName3) VALUES(@value1,@value2,@value3)

Note- In this Insert Query those Column you want to insert in table then define column name and give there values according field data type.
This is Syntax and you can see example so more clear about this query
Example
INSERT INTO Tbl_Employee(Name, Salary,City) VALUES ('Radhe',40000,'Jaipur')
Note -You can write this query and Run f5 then Show message "(1 row(s) affected)"
Result - You can run select query and see output record.

Update Query

In SQL Server you can use update record in table help of Update Query
Syntax
UPDATE TableName SET ColumnName1=@value1,ColumnName2=@value2 WHERE ColumnName Condition OPERATORE

Note- In this Update Query those existing Column you want to update in the table then define column name and set values according field data type if you want to give where condition then give if you not give where condition then reflect all this full of table.
This is Syntax and you can see example so more clear about this query
Example
UPDATE Tbl_Employee SET Name = 'Sita', Salary=12000 WHERE Id=4
Note -You can write this query and Run f5 then Show message "(1 row(s) affected)"
Result - You can run select query and see output record.

Delete Query

In SQL Server Delete query is used to delete record in SQL server.You can see example
Syntax
DELETE FROM TableName WHERE ColumnName Condition operator

Note- In this Delete Query those record you want to delete from table then use this delete query if you want to delete record according condition then use 'where Clause' and use which record you want to delete use this condition , if you not give where condition then reflect all this full of table.
This is Syntax and you can see example so more clear about this query
Example
DELETE FROM Tbl_Employee SET Name = 'Sita', Salary=12000 WHERE Id=4
Note -You can write this query and Run f5 then Show message "(1 row(s) affected)"
Result - You can run select query and see output record.

SQL In Operator

In SQL Server In Operator use to multiple value use in where clause.You  can use In operator and apply more than 1 values in where clause and get result according match  values you can see In operator example
Syntax
SELECT ColumnName FROM TableName WHERE ColumnName IN (value1,value2,...)

Note- Use this syntax find easily match record using In operator, Basically use In Sytax and give vales in where clause whatever you want to match.
This is Syntax and you can see example so more clear about this query
Example
SELECT Name FROM Tbl_Employee WHERE City IN ('Chittorgarh','Jaipur')
Note - You can write this query and Run f5 then You find result employee name those belongs city is Chittorgarh and Jaipur"
Result - You can run select query and see output record.

SQL Between Operator

In SQL Server Between Operator is used to select values within a range Commonly use for rang. You can see example
Syntax
SELECT ColumnName FROM TableName WHERE ColumnName Between value1 and value2

Note- Use this Syntax find record within range using Between operator, Basically use In syntax and give vales in where clause whatever you want to define rang.
This is Syntax and you can see example so more clear about this query
Example
SELECT Name FROM Tbl_Employee WHERE Salary Between 1000 and 30000
Note -You can write this query and Run f5 then You find result employee name those Salary between 1000 to 30000"
Result - You can run select query and see output record.

ALTER  Commands
The SQL ALTER TABLE command is used to add, delete or modify columns in an existing table.
You would also use ALTER TABLE command to add and drop various constraints on a an existing table.
Add new column in existing table through Alter Command
ALTER TABLE table_name ADD column_name datatype;
Drop column in existing table through Alter Command
ALTER TABLE table_name DROP COLUMN column_name;
Change The Data Type of  column in existing table
ALTER TABLE table_name MODIFY COLUMN column_name datatype;
Add  NOT NULL constraint to a column
ALTER TABLE table_name MODIFY column_name datatype NOT NULL;
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Email This BlogThis! Share to X Share to Facebook
Newer Post Older Post Home

0 comments :

Post a Comment

learningmvctutorial

Popular Posts

  • Overview
      SQL (Structured Query Language)   SQL  is a language that interacts with the database on the server-side. This dynamite duo has changed ...
  • Overview of HTML
    What is HTML? First developed by Tim Berners-Lee in 1990 . HTML is used to create electronic documents (called pages) that are displ...
  • Difference Between function v/s store procedure
    Definition  of Store Procedure In a database management system (DBMS), a  stored procedure  is a set of Structured Query Language (SQL...
  • What is LINQ
    LINQ  (Language Integrated Query) is a Microsoft programming model and methodology that essentially adds formal query capabilities into Mic...
  • SQL Select
    The SQL SELECT Statement The SELECT statement is used to select data from a database. SQL SELECT Syntax SELECT column_name , column_n...
  • What is Function in Sql Server
    A function is a block of code that has a name and it has a property that it is reusable. We use function in store Procedure and queries in...
  • About Javascript
    What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting langua...
  • Create Duplicate Table of existing table in SQL Server
    In This Tutorial we create table and want to same structure and same data then We create new table with data type after that  insert in ta...
  • Operator in JavaScript
    What is an operator? JavaScript has both binary and unary operators, and one special ternary operator, the conditional operator. A binar...
  • Create First Application in MVC
    We want to create Firstly application in MVC first of how we create first application Show Steps   as below-     STEP 1 .  Start Computer ...

Blog Archive

  • ▼  2017 ( 35 )
    • ►  November ( 1 )
    • ▼  October ( 2 )
      • Except vs NotNull in Sql Server
      • Sql Commands
    • ►  September ( 4 )
    • ►  August ( 1 )
    • ►  July ( 1 )
    • ►  May ( 3 )
    • ►  April ( 7 )
    • ►  March ( 13 )
    • ►  February ( 3 )
Powered by Blogger.

Categories

  • AdvanceQuery
  • CreateApplication
  • CreateDb
  • CssOverview
  • Evolution
  • Formatting
  • Function
  • FunctionVSSp
  • HtmlOverview
  • InstallVisualStudio
  • Introduction
  • javascriptOverview
  • JsValidation
  • Mvc-vs-Asp.Net
  • OverView
  • Select
  • SqlCommand
  • SQLOverview
  • StoredProcedures

Text Widget

Sample Text

Pages

  • Home

Copyright © MVC | Powered by Blogger
Design by Vibha Acharya