Posts

CLASS 3 - Joins in SQL

Image
1. What is SQL JOIN’s? An  SQL join  clause combines columns from one or more tables in a relational database. It creates a set that can be saved as a table or used as it is. A JOIN is a means for combining columns from one (self-join) or more tables by using values common to each. 2. What are the different types of SQL JOINs ? The list of different types of SQL JOINs as follows: ·          INNER JOIN ·          LEFT JOIN ·          RIGHT JOIN ·          FULL JOIN 3. What is left outer join? SQL  LEFT JOIN  Keyword. The LEFT JOIN keyword returns all records from the lefttable (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match. 4. What is a full outer join? SQL FULL OUTER ...

CLASS 2 - working with DATABASE, What is Constraints ?what are they?

Creating, altering and dropping a database      1.Graphically using SQL Server Management Studio (SSMS) or      2. Using a Query Whether, you create a database graphically using the designer or, using a query, the following 2 files gets generated. .MDF file - Data File (Contains actual data) .LDF file - Transaction Log file (Used to recover the database ) To alter a database, once it's created   Alter database DatabaseName Modify Name = NewDatabaseName Alternatively, you can also use system stored procedure Execute sp_renameDB ' OldDatabaseName ',' NewDatabaseName ' To Delete or Drop a database Drop Database DatabaseThatYouWantToDrop Dropping a database, deletes the LDF and MDF files. You cannot drop a database, if it is currently in use. You get an error stating - Cannot drop database " NewDatabaseName " because it is currently in use. So, if other users are connected, you need to put the database in single us...