Posts Tagged with 'SQL'
Compare timestamp with date only
SQL | Compare timestamp with date only Timestamp holds Date and Time both with 19 characters. To filter table record with the only date parameter can be achieved by SQL DATE() function. Consider the Employee table …
Select date range from timestamp column
SQL | Timestamp in where clause to select the date range Select date range from the timestamp column with where clause can be done by using the BETWEEN operator. BETWEEN Operator : The BETWEEN operator selects …
What do you mean by foreign key?
SQL | Foreign Key A foreign key is a key used to link two tables. A Primary key of a table is used as a foreign key for the other table. The primary key …
What is a view in SQL?
SQL | View View in SQL is a kind of virtual table. It does not physical exists in our database but have rows and column as there we have in a real database table. we …
What is the difference between primary key and unique constraints?
SQL | Difference between primary key and unique constraints There is only one primary key in a table. It creates the clustered index automatically and it cannot have NULL value whereas there can be multiple …
Write an SQL query to find names of employee start with 'A'?
SQL | LIKE operator The LIKE operator of SQL is used for such kind of operations. It is used to fetch filtered data by searching for a particular pattern in where clause. The Syntax for …
What is the difference between BETWEEN and IN operator in SQL?
SQL | difference between BETWEEN and IN operator The BETWEEN operator selects all records between the given range whereas IN operator selects all matching records given with the WHERE clause. BETWEEN operator The Between operator in …
Find nth largest salary from employees table?
By using following query we can find out the nth largest salary from employees table. SELECT salary FROM `employees` ORDER BY salary DESC LIMIT 1 OFFSET n-1 In the above query n is replaced by …
SQL Update statement
SQL Update statement The UPDATE statement is used to update the records of an existing table in a database. We can update single as well as multiple columns using SQL update statement. The basic syntax …
How can we optimize a table?
OPTIMIZE command is use for optimize a table. OPTIMIZE TABLE `users`