<< < 10 11 12 13 14 15 16 17 18 19 > >>   ∑:454  Sort:Rank

Assigning New Column Names in a View in SQL Server
How To Assign New Column Names in a View in SQL Server? By default, column names in a view are provided by the underlying SELECT statement. But sometimes, the underlying SELECT statement can not provide names for output columns that specified as expressions with functions and operations. In this cas...
2016-11-03, 1607🔥, 0💬

Testing Table for DML Statements in SQL Server
How To Create a Testing Table with Test Data in SQL Server? If you want to practice DML statements, like INSERT, UPDATE and DELETE statements, you should create a testing table. The tutorial exercise shows you a good example: CREATE TABLE fyi_links (id INTEGER PRIMARY KEY, url VARCHAR(80) NOT NULL, ...
2016-11-03, 1574🔥, 0💬

"INSERT INTO" - Inserting a New Row into a Table in SQL Server
How To Insert a New Row into a Table with "INSERT INTO" Statements in SQL Server? To insert a new row into a table, you can use the INSERT INTO statement with values specified for all columns as in the following syntax: INSERT INTO table_name VALUES (list_of_values_of_all columns) Note that the list...
2016-11-03, 1461🔥, 0💬

DEFAULT - Using Column Default Values in INSERT Statements in SQL Server
How To Use Column Default Values in INSERT Statements in SQL Server? If a column is defined with a default value in a table, you can use the key word DEFAULT in the INSERT statement to take the default value for that column. The following tutorial exercise gives a good example: INSERT INTO fyi_links...
2016-11-03, 1459🔥, 0💬

Determining Data Types of View Columns in SQL Server
How Column Data Types Are Determined in a View in SQL Server? When you define a view, its columns are defined through a list of expressions in the underlying SELECT statement. Their data types will be determined implicitly by the expressions. For example, if the column expression is a column name of...
2016-11-03, 1424🔥, 0💬

Deleting Data from a View in SQL Server
Can You Delete Data from a View in SQL Server? Can you delete data in a view? The answer is no. But if the question is "Can you delete data from the underlying table through view?" The answer is then yes. SQL Server will allow you to delete data from the underlying table through a view. The tutorial...
2016-11-03, 1250🔥, 0💬

Creating an Index on a View in SQL Server
How To Create an Index on a View in SQL Server? If you need to search and sort data in a view with a large number of row, you may want to create an index on the view to speed up your search process. The tutorial exercise below shows you how to create a unique clustered index on a view. DROP VIEW fyi...
2016-11-03, 1231🔥, 0💬

Updating Multiple Rows with One UPDATE Statement in SQL Server
How To Update Multiple Rows with One UPDATE Statement in SQL Server? If the WHERE clause in an UPDATE statement matches multiple rows, the SET clause will be applied to all matched rows. This rule allows you to update values on multiple rows in a single UPDATE statement. Here is a good example: SELE...
2016-11-02, 3194🔥, 0💬

UPDATE Subquery Returning Multiple Rows in SQL Server
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a UPDATE statement, it must return exactly one row for each row in the update table that matches the WHERE clause. If it returns multiple rows, SQL Server will give you an error message. To test this ou...
2016-11-02, 2986🔥, 0💬

Using Old Values to Define New Values in UPDATE Statements in SQL Server
How to use old values to define new values in UPDATE statements in SQL Server? If a row matches the WHERE clause in a UPDATE statement, existing values in this row can be used in expressions to provide new values in the SET clause. Existing values are represented by column names in the expressions. ...
2016-11-02, 1566🔥, 0💬

Duplicate Key Error on Primary Key Columns in SQL Server
What Happens If You Insert a Duplicate Key for the Primary Key Column in SQL Server? If your table has a primary key column, and you are trying to insert a new row with duplicate key value on the primary key column, you will get an error. The reason is simple - Primary key column does not allow dupl...
2016-11-02, 1422🔥, 0💬

Inserting Multiple Rows with One INSERT Statement in SQL Server
How To Insert Multiple Rows with One INSERT Statement in SQL Server? If you want to insert multiple rows with a single INSERT statement, you can use a subquery instead of the VALUES clause. Rows returned from the subquery will be inserted the target table. The following tutorial exercise gives you a...
2016-11-02, 1419🔥, 0💬

Importance of Column Order in the SET Clause in Update Statements in SQL Server
Is the Order of Columns in the SET Clause Important in SQL Server? The answer is NO. The order of columns in the SET clause of the UPDATE statement is NOT important. You probably already noticed from the previous tutorial. There is a BIG DIFFERENCE among SQL Server, MySQL and Oracle on update multip...
2016-11-02, 1413🔥, 0💬

UPDATE Subquery Returning No Rows in SQL Server
What Happens If the UPDATE Subquery Returns No Rows in SQL Server? If you use a subquery to assign new values in the SET clause in an UPDATE statement, and the subquery returns no rows for an outer row, SQL Server will provide a NULL value to the SET clause. The tutorial exercise below shows you a g...
2016-11-02, 1365🔥, 0💬

Updating Values with UPDATE Statements in SQL Server
How To Update Values in a Table with UPDATE Statements in SQL Server? If you want to update some values in one row or multiple rows in a table, you can use the UPDATE statement. The tutorial script below shows a good example: SELECT * FROM fyi_links WHERE id = 101 GO id url notes counts created 101 ...
2016-11-02, 1353🔥, 0💬

Using Values from Other Tables in UPDATE Statements in SQL Server
How To Use Values from Other Tables in UPDATE Statements in SQL Server? If you want to update values in one table with values from another table, you can use a subquery as an expression in the SET clause. The subquery should return only one row for each row in the update table that matches the WHERE...
2016-11-02, 1307🔥, 0💬

Providing Column Names in INSERT Statements in SQL Server
How to provide column names in INSERT Statements in SQL Server? If you don't want to specify values for columns that have default values, or you want to specify values to columns in an order different than how they are defined, you can provide a column list in the INSERT statement. If a column is om...
2016-11-02, 1256🔥, 0💬

"RIGHT OUTER JOIN ... ON" - Writing Queries with Right Outer Joins in SQL Server
How To Write a Query with a Right Outer Join in SQL Server? If you want to query from two tables with a right outer join, you can use the RIGHT OUTER JOIN ... ON clause in the FROM clause. The following query returns output with a right outer join from two tables: fyi_links and fyi_rates. The join c...
2016-10-30, 1946🔥, 0💬

"LEFT OUTER JOIN ... ON" - Writing Queries with Left Outer Joins in SQL Server
How To Write a Query with a Left Outer Join in SQL Server? If you want to query from two tables with a left outer join, you can use the LEFT OUTER JOIN ... ON clause in the FROM clause. The following query returns output with a left outer join from two tables: fyi_links and fyi_rates. The join condi...
2016-10-30, 1896🔥, 0💬

"INNER JOIN ... ON" - Writing Queries with Inner Joins in SQL Server
How To Write a Query with an Inner Join in SQL Server? If you want to query from two tables with an inner join, you can use the INNER JOIN ... ON clause in the FROM clause. The tutorial exercise below creates another testing table and returns output with an inner join from two tables: fyi_links and ...
2016-10-30, 1838🔥, 0💬

Using SELECT Statements with Joins and Subqueries in SQL Server
Where to find answers to frequently asked questions on Using SELECT Statements with Joins and Subqueries in SQL Server? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Using SELECT Statements with Joins and Subqueries in SQL Server. Clear answers ...
2016-10-30, 1370🔥, 0💬

Defining and Using Table Alias Names in SQL Server
How To Define and Use Table Alias Names in SQL Server? When column names need to be prefixed with table names, you can define table alias name and use them to prefix column names. To define an alias for a table name, just enter the alias name right after the original table name in the FROM clause as...
2016-10-30, 1351🔥, 0💬

Deleting All Rows with TRUNCATE TABLE Statement in SQL Server
How To Delete All Rows with TRUNCATE TABLE Statement in SQL Server? If you want to delete all rows from a table, you have two options: Use the DELETE statement with no WHERE clause. Use the TRUNCATE TABLE statement. The TRUNCATE statement is more efficient the DELETE statement. The tutorial exercise...
2016-10-30, 1348🔥, 0💬

Deleting All Rows with DELETE Statements in SQL Server
How To Delete All Rows with DELETE Statements in SQL Server? If you want to delete all rows from a table, you have two options: Use the DELETE statement with no WHERE clause. Use the TRUNCATE TABLE statement. Here is an example of deleting all rows with a DELETE statement: SELECT COUNT(*) FROM fyi_l...
2016-10-30, 1337🔥, 0💬

<< < 10 11 12 13 14 15 16 17 18 19 > >>   ∑:454  Sort:Rank