Topics Search

Query to find the second highest column value in a table

Query to find the second highest column value in a table
Views: 452
In this ms sql server tutorial you will learn query to find the second highest column value in a table.
Sponsored Links:

More topics

 

Second Highest Salary in MySQL and SQL Server

Preview
Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the second highest salary is 200. If there is no second highest salary, then the query should return NULL. You can write SQL query in any of your favorite database e.g. MySQL, Microsoft SQL Server or Oracle.
 

Query to find the second lowest column value in a table

Preview
In this ms sql server tutorial you will learn query to find the second lowest column value in a table.
 

Select the Nth Highest Record in a Database Table

Preview
In this tutorial, you will learn how to select the Nth highest record in a database table by using various techniques. These techniques are very useful, for instance you may want to see the product which is second most expensive in Products database table.
 

Changing Column Size

Preview
Changing the size of a column in MySQL is pretty easy. By using alter table and modify you are able to choose a column on a specified table and resize it. Learn how to resize a MySQL column.
 

Display records in multi column format with PHP

Preview
This two videos explain how to populate records from the MySQL database and display them on the page in the multi column format. Each column follows the ascending order of the records from the previous column. In this example we are using Table, but you can use any HTML element to display records in multi column format.
 

How to Change a Column Name

Preview
If you have created a database and decide later that one of the column names you chose isn't exactly what you want, you can rename it. You do this using alter table and change. Together they can be used to rename a MySQL column.
 

Changing Table Structure Using MySQL ALTER TABLE

Preview
Changing existing table structure is a very important task especially when the current table structure no longer reflects the new business's needs. In this tutorial, you will learn about MySQL ALTER TABLE statement to change existing table structure such as add or drop column, change column attribute and rename table.
 

MySQL Datatypes

Preview
Once you have your table data organized, the next step is to figure out the data type. There are three main types : text, numbers, and Dates/Times. Choosing the column types specifies what information can or can't be stored in a table cell. Using the most correct option for each column is important as it may affect the database's overall performance.
 

Order a string column as an integer

Preview
If you order a string column that contains only numeric values with MySQL, it will order them as string values, e.g.: 1, 10, 100, 2, 3, 31, 32, 4, etc. If you want to order them as if they were an integer, cast them in the order by clause.
Normally you'd store numeric values in a numeric column in the database, but sometimes this isn't possible. For example, the postmeta table in WordPress has a meta_value column which is a string and in which you might store only numeric values for a particular meta_key field.
 

Reset Auto-Increment In MySql

Preview
In this post i going to demonstrate how to reset auto-increment value in MySql. There is no doubt MySQL provides an awesome feature called auto-increment. We assign the auto-increment attribute to a column of a table. Every time new row is inserted it increments the value. By default the auto-increment column is primary key of a table.