Basic SQL Commands

All SQL Commands


SQL is a language to operate databases; it includes database creation, deletion, fetching rows, modifying rows, etc


What is SQL?


SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in a relational database.


QUERY  : -


1.How to create Database  : A Database is defined as a structured set of data. So, in SQL the very first step to store the data in a well structured manner is to create a database. The CREATE DATABASE statement is used to create a new database in SQL.


___ we want create student name database


 
                                

2. How to check your database create or not / show databases 


 

3. How to delete database

 



4. How to create a table in Database  : CREATE TABLE creates a new table in the database. It allows you to specify the name of the table and the name of each column in the table.


 



5. How to check your table create or not in database / show table list 

 



Most used Database by Developers in 2021Click here


6. How to check table desc 

 


7. For drop table in database

 


8. How to data insert in table : The INSERT INTO statement is used to insert new records in a table.


 


9. check your data insert in table or not

 


10.  if We want delete row in table  : DELETE statements are used to remove rows from a table.


 

    

11. How to add column in table

 



12. How to fill blank column

 


13.   find record by id


 


14. find only one value in table

 


15. Use alias   : AS is a keyword in SQL that allows you to rename a column or table using an alias.


 


16. Select record without duplicate field in table : SELECT DISTINCT specifies that the statement is going to be a query that returns unique values in the specified column(s).


 


17. find two or more value in table : The BETWEEN operator is used to filter the result set within a certain range. The values can be numbers, text or dates.


 


18. Use  OR Syntax :  OR is an operator that filters the result set to only include rows where either condition is true.


 


19. Search top three rows in table

 


20. Search after three id rows 

 


21. Data show in Descending order : ORDER BY is a clause that indicates you want to sort the result set by a particular column either alphabetically or numerically.

 


22. show data in last two rows 

 


23. How to add total column : SUM() is a function that takes the name of a column as an argument and returns the sum of all the values in that column.


 


24. Find min id from table  : MIN() is a function that takes the name of a column as an argument and returns the smallest value in that column.


 


25. Find max id from table  : MAX() is a function that takes the name of a column as an argument and returns the largest value in that column.


 


26. How to find the employee whose salary is minimum.


 


27. How to find the employee whose salary is highest


 

28. How to insert data in blank column : UPDATE statements allow you to edit rows in a table.


 

29. Use Inner JOIN : An inner join will combine rows from different tables if the join condition is true.


 

30. Use LEFT JOIN  : An outer join will combine rows from different tables even if the join condition is not met. Every row in the left table is returned in the result set, and if the join condition is not met, then NULL values are used to fill in the columns from the right table.


 

31. use RIGHT JOIN

 



Most used Database by Developers in 2021Click here