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

Monday, 16 October 2017

Except vs NotNull in Sql Server

  Unknown       09:52       No comments    

EXCEPT & INTERSECT command in SQL Server


EXCEPT


In this Article EXCEPT command use to commind two queries and find dinctinct records. EXCEPT returns any left query values which are not exist in right query. You can use Except command and easily find distinct value of one table when you want filter values.

SYNTAX


The Syntax of EXCEPT command
SELECT ColumnName1,ColumnName2,....ColumnNameN FROM TableName1
EXCEPT
SELECT ColumnName1,ColumnName2,....ColumnNameN FROM TableName2

Note - You Should know about same number of column in all Queries Example of Except Command in SQL server you can more clear in example
Example
. SELECT * from Table1
EXCEPT
select * from Table2
Note -You can write this query and execute (f5) after that You got result 'name which is ditinct and not match in right table.'
Result - You can see output record.
Image

Intersect


In this Article Intersect command use to commind two queries and find common records. You can use Intersect command and easily find common values.

SYNTAX


The Syntax of Intersect command
SELECT ColumnName1,ColumnName2,....ColumnNameN FROM TableName1
Intersect
SELECT ColumnName1,ColumnName2,....ColumnNameN FROM TableName2

Note - You Should know about same number of column in all Queries Example of Intersect Command in SQL server you can more clear in example
Example
SELECT * from Table1
INTERSECT
select * from Table2
Note -You can write this query and execute (f5) after that You find result 'name which is common in both table.'
Result - You can see output record.
Image

What is a NULL Value in Sql?


In this tutorial we describe that NULL value is a field with does not have any value. You can Insrt a new record and update without any value then field have 'no value' and field will be saved with a NULL value
Note - NULL value is different from a zero value or a field that contains spaces. A field with a NULL value is one that has been left blank during record creation.

What is Not NULL Value in Sql?


In this tutorial we describe that Not NULL value is a field which have value ,doesn't null value.

Difference between Except vs Not In

Except


EXCEPT filters the DISTINCT values from the left-hand table that do not appear in the right-hand table. It's essentially the same as doing a NOT EXISTS with a DISTINCT clause.
It also expects the two tables (or subset of columns from the tables) to have the same number of columns in the left and right hand side of the query

NOT IN

NOT IN does not filter for DISTINCT values and returns all values from the left-hand table that do not appear in the right-hand table.
NOT IN requires you compare a single column from one table with a single column from another table or subquery.
For example, if your subquery was to return multiple columns:
SELECT * FROM TableA AS nc WHERE ID NOT IN (SELECT ID, Name FROM TableB AS ec)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+

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;
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Newer Posts Older Posts Home

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...
  • 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 LINQ
    LINQ  (Language Integrated Query) is a Microsoft programming model and methodology that essentially adds formal query capabilities into Mic...
  • 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...
  • 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...
  • About Javascript
    What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting langua...
  • Operator in JavaScript
    What is an operator? JavaScript has both binary and unary operators, and one special ternary operator, the conditional operator. A binar...
  • Open Application in MVC
    We want to create application in MVC first of how we create first application Show Steps   as below-     STEP 1 .  Start Computer and  I...

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