What is the SQL “in” clause

SQL IN operator is used to see if the value exists in a group of values. For instance the below SQL checks if the Name is either ‘rohit’ or ‘Anuradha’ SELECT * FROM pcdsEmployee WHERE name IN (‘Rohit’,’Anuradha’) Also you can specify a not clause with the same. SELECT * FROM pcdsEmployee WHERE age NOT … Read more

What is order by clause

ORDER BY clause helps to sort the data in either ascending order to descending order. Ascending order sort query: SELECT name,age FROM pcdsEmployee ORDER BY age ASC Descending order sort query SELECT name FROM pcdsEmployee ORDER BY age DESC The correct answer for “What is the ORDER BY clause in a database management system (DBMS)?” … Read more

Can you explain Insert, Update and Delete query

Insert statement is used to insert new rows in to table. Update to update existing data in the table. Delete statement to delete a record from the table. Below code snippet for Insert, Update and Delete :- INSERT INTO pcdsEmployee SET name=’rohit’,age=’24’; UPDATE pcdsEmployee SET age=’25’ where name=’rohit’; DELETE FROM pcdsEmployee WHERE name = ‘sonia’; … Read more

What is Like operator for and what are wild cards

LIKE operator is used to match patterns. A “%” sign is used to define the pattern. Below SQL statement will return all words with letter “S” SELECT * FROM pcdsEmployee WHERE EmpName LIKE ‘S%’ Below SQL statement will return all words which end with letter “S” SELECT * FROM pcdsEmployee WHERE EmpName LIKE ‘%S’ Below … Read more

How do we select distinct values from a table

DISTINCT keyword is used to return only distinct values. Below is syntax:- Column age and Table pcdsEmp SELECT DISTINCT age FROM pcdsEmp To select distinct values from a table in a relational database management system (DBMS), you would typically use the SELECT DISTINCT statement. Here’s the general syntax: sql SELECT DISTINCT column1, column2, … FROM … Read more