<< < 42 43 44 45 46 47 48 49 50 51 52 > >>   ∑:1243  Sort:Rank

Deleting Multiple Rows with One DELETE Statement in SQL Server
How To Delete Multiple Rows with One DELETE Statement in SQL Server? You can delete multiple rows from a table in the same way as deleting a single row, except that the WHERE clause will match multiple rows. The tutorial exercise below deletes 3 rows from the fyi_links table: -- view rows to be dele...
2016-10-30, 1355🔥, 0💬

Deleting an Existing Row with DELETE Statements in SQL Server
How To Delete an Existing Row with DELETE Statements in SQL Server? If you want to delete an existing row from a table, you can use the DELETE statement with a WHERE clause to identify that row. Here is good sample of DELETE statements: -- insert a row for this test INSERT INTO fyi_links (url, id) V...
2016-10-30, 1302🔥, 0💬

Joining Two Tables in a Single Query in SQL Server
How To Join Two Tables in a Single Query in SQL Server? Two tables can be joined together in a query in 4 ways: Inner Join: Returns only rows from both tables that satisfy the join condition. Left Outer Join: Returns rows from both tables that satisfy the join condition, and the rest of rows from th...
2016-10-30, 1279🔥, 0💬

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

Returning the Second 5 Rows from a Query in SQL Server
How To Return the Second 5 Rows in SQL Server? If you want to display query output in multiple pages with 5 rows per page, and the visitor wants to see the output for the second page, you need to display query output from row 6 to row 10. If you are using MySQL server, you can use the "LIMIT startRo...
2016-10-29, 1394🔥, 0💬

Using Subqueries in the FROM Clause in SQL Server
How To Use Subqueries in the FROM Clause in SQL Server? If you have a query returning many rows of data, and you want to perform another query on those rows, you can put the first query as a subquery in the FROM clause of the second query. A subquery used in this way become a temporary table, and yo...
2016-10-29, 1366🔥, 0💬

Using Subqueries with the EXISTS Operators in SQL Server
How To Use Subqueries with the EXISTS Operators in SQL Server? A subquery can be used with the EXISTS operator as "EXISTS (subquery)", which returns true if the subquery returns one or more rows. The following statement is a good example of "EXISTS (subquery)". It returns rows from fyi_links table t...
2016-10-29, 1351🔥, 0💬

Counting Groups Returned with the GROUP BY Clause in SQL Server
How To Count Groups Returned with the GROUP BY Clause in SQL Server? If you use the COUNT(*) function on groups returned with the GROUP BY clause, it will count the number of rows within each group, not the number of groups. If you want to count the number of groups, you can put the GROUP BY query i...
2016-10-29, 1343🔥, 0💬

Writing Inner Joins with the WHERE Clause in SQL Server
How To Write an Inner Join with the WHERE Clause in SQL Server? If you don't want to use the INNER JOIN ... ON clause to write an inner join, you can put the join condition in the WHERE clause as shown in the following query example: SELECT l.id, l.url, r.comment FROM fyi_links l, fyi_rates r WHERE ...
2016-10-29, 1339🔥, 0💬

"TOP" - Return the Top 5 Rows from a SELECT Query in SQL Server
How To Return the Top 5 Rows from a SELECT Query in SQL Server? If you want the query to return only the first 5 rows, you can use the "TOP 5" clause. The TOP clause takes one parameter to indicate how many top rows to return. The following statements returns the first 5 rows and 3 rows from the fyi...
2016-10-29, 1299🔥, 0💬

Using Subqueries with the IN Operators in SQL Server
How To Use Subqueries with the IN Operators in SQL Server? A subquery can be used with the IN operator as "expression IN (subquery)". The subquery should return a single column with one or more rows to form a list of values to be used by the IN operation. The following tutorial exercise shows you ho...
2016-10-29, 1273🔥, 0💬

"AS" - Naming Query Output Columns in SQL Server
How To Name Query Output Columns in SQL Server? Each column in the query output has a default name. If you don't like the default name, you can specify a new name for any column in the query output by using the AS clause. The following statement shows you a good example: SELECT tag AS Category, YEAR...
2016-10-29, 1244🔥, 0💬

What Is a Subquery in a SELECT Query Statement in SQL Server
What Is a Subquery in a SELECT Query Statement in SQL Server? A subquery is a SELECT statement used as part of the selection criteria of the main SELECT statement. The subquery specified in the WHERE clause will be evaluated repeated on each row of the selection base table. The output of the subquer...
2016-10-29, 1151🔥, 0💬

Counting Rows with the COUNT(*) Function in SQL Server
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows, you can use the COUNT(*) function in the SELECT clause. The following tutorial exercise shows you some good examples: SELECT COUNT(*) FROM fyi_links GO 7 SELECT COUNT(*) FROM fyi_links WHERE url LIKE...
2016-10-26, 3309🔥, 0💬

Selecting All Columns of All Rows from a Table in SQL Server
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simplest query statement is the one that selects all columns of all rows from a single table: "SELECT * FROM tableName". The (*) in the SELECT clause tells the query to return all columns. The missing WHERE...
2016-10-26, 3268🔥, 0💬

Selecting Some Specific Columns from a Table in SQL Server
How To Select Some Specific Columns from a Table in a Query in SQL Server? If you want explicitly tell the query to return some specific columns, you can specify the column names in the SELECT clause. The following select statement returns only three columns, "id", "created" and "url" from the table...
2016-10-26, 1996🔥, 0💬

Using SELECT Statements on Views in SQL Server
Can SELECT Statements Be Used on Views in SQL Server? Select (query) statements can be used on views in the same way as tables. The following tutorial exercise helps you creating a view and running a query statement on the view: CREATE VIEW myLinks AS SELECT * FROM fyi_links WHERE url LIKE '%fyi%' G...
2016-10-26, 1865🔥, 0💬

Selecting Some Specific Rows from a Table in SQL Server
How To Select Some Specific Rows from a Table in SQL Server? If you don't want select all rows from a table, you can specify a WHERE clause to tell the query to return only the rows that meets the condition defined in the WHERE clause. The WHERE clause condition is a normal Boolean expression. If an...
2016-10-26, 1614🔥, 0💬

Using SELECT Statements and GROUP BY Clauses in SQL Server
Where to find answers to frequently asked questions on Using SELECT Statements and GROUP BY Clauses in SQL Server? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Using SELECT Statements and GROUP BY Clauses in SQL Server. Clear answers are provid...
2016-10-26, 1511🔥, 0💬

Sorting Query Output in Descending Order in SQL Server
How To Sort Query Output in Descending Order in SQL Server? If you want to sort a column in descending order, you can specify the DESC keyword in the ORDER BY clause. The following SELECT statement first sorts the "tag" in descending order, then sorts the "counts" in ascending order: SELECT tag, cou...
2016-10-26, 1437🔥, 0💬

Using ORDER BY with UNION Operators in SQL Server
How To Use ORDER BY with UNION Operators in SQL Server? If you need to sort the output from two queries grouped together with a UNION operator, you need to apply the ORDER BY clause at the group level, not at the subquery level. Note that SQL Server and MySQL react differently to the ORDER BY clause...
2016-10-26, 1398🔥, 0💬

Sorting Query Output by Multiple Columns in SQL Server
Can the Query Output Be Sorted by Multiple Columns in SQL Server? You can specifying multiple columns in the ORDER BY clause as shown in the following example statement, which returns rows sorted by "tag" and "counts" values: SELECT tag, counts, url, created FROM fyi_links ORDER BY tag, counts GO ta...
2016-10-26, 1390🔥, 0💬

What Is a SELECT Query Statement in SQL Server
What Is a SELECT Query Statement in SQL Server? The SELECT statement is also called the query statement. It is the most frequently used SQL statement in any database application. SELECT statements allows you to retrieve data from one or more tables or views, with different selection criteria, groupi...
2016-10-26, 1389🔥, 0💬

Testing Table for SELECT Statements in SQL Server
How To Create a Testing Table with Test Data to try with SELECT statements in SQL Server? If you want to follow the tutorial exercises presented in this collection, you need to create a testing table and insert some test data, as shown in the following sample script: CREATE TABLE fyi_links (id INTEG...
2016-10-26, 1376🔥, 0💬

<< < 42 43 44 45 46 47 48 49 50 51 52 > >>   ∑:1243  Sort:Rank