SQL 101 : CH 1 Notes : Teach yourself SQL

These notes should be more than enough to revise and learn stuff. No need to go to book after it. Examples are also included for better revision and understanding of concepts.
SQL session commands :
1)     CONNECT - Command is used to connect to a database. This command can either invoke a connection or change the connection to the database. Ex. connected as USER1 and gave command of USER2, the command will terminate the previous user connection and establish the connection for USER2.
    Syntax: CONNECT user@database.  
    link: Official documentation for CONNECT command
    Takeaway -> Initializing a database can be tricky and not as simple as opening a Jupyter book. Be thorough with the process. All SQL servers are password-protected.

2)     DISCONNECT AND EXIT ->  Use to disconnect a user from a database. 
        Exit: While giving the disconnect command, the software might communicate with the database but                      the connection is lost. Giving the EXIT command fully terminates the software communication                   with the database. 
        Syntax:         DISCONNECT;     EXIT ;
        LINK: DISCONNECT command documentation
        Takeaway -> DISCONNECT command disconnects the user but not the software from the db.
        LINK: EXIT command documentation
        Takeaway: It is also used to HALT the loops once done.

--->>>    WHAT ARE "IJ" COMMANDS ??
                LINK: IJ Command use
                            IJ commands; usefulness
                Takeaway: Understand IJ command characteristics to understand the syntax.        

* Types of SQL Commands - > 
    1) DDL - Data Definition Language -> Part of SQL that enables a database user to create, update and restructure database objects. Most fundamental DDL commands - > CREATE, ALTER, DROP, TRUNCATE. 
    Link: DDL explanation and syntax example

    2) DML - Data Manipulation Language -> Manipulating data -> Part of SQL that is used to manipulate data within objects of a relational database. Most fundamental commands -> INSERT, UPDATE, DELETE. These are the commands which help analysts to do their work.
Link: DML commands use with syntax

    3) DQL - Data Query Language -> Inquiry to the database systems. Have only one command - SELECT. 
        Link: Important Link to learn all command types.

    4) DCL - Data Control Commands -> Use to control access to data within the database either by granting privileges or revoking privileges to the users in the databases. Most fundamental commands -> ALTER PASSWORD, GRANT, REVOKE, CREATE SYONYM.
        Link: DQL in detail use case with syntax

    5) Data Administration Command -> This concept is different from DataBase administration. 
        Have to understand this in detail via proper search.

    6) TCL - Transactional Control Commands -> These commands help users manage and control database transactions. Most fundamental commands -> BEGIN TRANSACTION, COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION.
    LINK: TCL explanation with syntax

  • What differentiates each row in a data from others or what makes each row in a data Unique?
  •        Ans: PRIMARY KEY 

There are many elements in a table like rows or records, fields, columns, primary keys, null values, etc.
A standard naming convention has to be followed while naming tables or databases.

Example of table relationships: Refer book example and 

  • Point to ponder -> Difference between Client/Server technology and Web technologies. In detail discussion and research in another blog (Blog link's.).

Popular posts from this blog

Swing Trading mindset

6th Jan, 2025 Nifty trade day