Database Tutorials

How to use aggregate SQL Select statements

Web developer can use special aggregate SQL functions which work with a set of values but return only a single value. For example, Web developer can use use an aggregate function to count the number of records in a table or to calculate the average price of a product:

     – Avg(fieldname) – Calculates the average of all values in …

Learn more

How to perform string matching with the SQL Like operator

Web developer can use the SQL Like operator to perform partial string matching to filter records where a particular field starts with, end with, or contains a certain sets of characters. For example, if Web developer wants to see all store applicants names that start with C, he/she could use the following statement:

SELECT * FROM Applicants WHERE appl_fname …

Learn more

How to use alternative SQL Select statement

Web developer can use the Top clause instead of a Where clause. For example:

SELECT TOP 100 * FROM Orders ORDER_BY ord_date DESC

The database rows will be sorted in descending order by order date, and the first 100 matching results will be retrieved. In this case, it’s the 100 most recent orders. Web developer could also use this type …

Learn more

How to use a Where clause in SQL Select statements.

In many cases, the Where clause is the most important part of the Select statement. Web developer can find records that match several conditions using the And keyword, and he/she can find records that match any one of a series of conditions using the Or keyword. Web developer can also specify greater-than and less-than comparisons by using the …

Learn more

How to improve SQL Select statement

The following is an example of typical and inefficient Select statement. It works with the Clients table:

SELECT * FROM Clients

-The asterisk (*) retrieves all the columns in the table. This isn’t the best approach for a large table if a Web developer does not need all the information. It increases the amount of data that has to be …

Learn more

How to use SQL Select statement

Web developer can retrieve one or more rows of data, by using SQL select statement which has the following structure:

SELECT [columns]
FROM [tables]
WHERE [search_condition]
ORDER BY [order_expression ASC | DESC]

Related TutorialsHow to delete a database diagram in Object Explorer
How to remove a table from a database diagram in SQL server
How to identify a SQL Server Express instance
How to create a …

Learn more

How to create SQL Server Login with SQL Server Management Studio

Create a SQL Server login that uses Windows Authentication

1.In SQL Server Management Studio, open Object Explorer and expand the folder of the server instance in which to create the new login.

2.Right-click the Security folder, select New, and then click Login.

3.Enter the name of a Windows user in the Login name box.

4.Select Windows Authentication.

5.Click OK.

Create a SQL Server login …

Learn more

How to reset autonumber in Access 2007

To reset autonumber in Microsoft Office Access 2007, follow these steps:

Delete the AutoNumber field from the main table.
Click the Create tab, and then choose Query Design.
In the Show Table dialog box, select the main table. Click Add, and then Close.
Double-click the required fields in the table view of the main table to select the fields.
Select the required Sort …

Learn more

How to create Oracle connection string

You should add a ConnectionStrings element in your Web.config file. The samle connection string for Oracle database might look like the following:

<add name=”OracleConnectionString”  connectionString=”Data Source=OracleS;Persist   Security Info=True;Password=”******”;User ID=Test”  providerName=”System.Data.OracleClient” />

 name  – set the value to the name that you want to use to reference the connection string.
connectionString – assign the connection string that is required to connect to the Oracle database.
providerName – assign the …

Learn more

How to create MySQL connection string

The following is a sample MySQL connection string:

Server=127.0.0.1;Uid=user;Pwd=userpassword;Database=allusers;

In this example, the MySqlConnection object is configured to connect to a MySQL server at 127.0.0.1, with a user name of user and a password of userpassword. The default database for all statements will be the …

Learn more