# SQL Lecture 1

A few Commands that I learned.

1. create database nxm301
    
2. drop database nxm301
    
3. queries are case-insensitive
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710184131180/b4613457-768d-4208-a797-8cc37534ab07.png align="center")

while creating a table, we have to create a schema

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710184459164/69c1850c-d5ab-415c-9b93-9b4781c0d743.png align="center")

Insert a value in a table

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710185122126/ddd17133-fce9-433e-be20-63d3b71a5b2d.png align="center")

`Reading data` from the database Command

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710185241134/238b3697-1a3a-483d-900c-67f69d8b331b.png align="center")

selecting specific data

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710185596762/443402d5-dfb1-4201-9231-204f0d3fea28.png align="center")

Creating a table SQL using constraints, primary key  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710266030643/c0c3a384-bb79-427b-a5b1-d08f622d2903.png align="center")

If you don't want to add id from your end, you can use auto\_increment  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710266318957/3dbe18f8-8bd0-4aa5-b73d-56812f0df0bb.png align="center")

Inserting multiple values into a table at once

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710267487859/139c9fe1-730d-474a-a17f-f46d020f7229.png align="center")

**  
FILTERING**

**Filter those customers whose name is "Nrupul" in SQL**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710267920064/5e4e85b7-f737-45e0-bc0f-0f55373860b6.png align="center")

**filter - want see those rows where first 2 letter are nr**

* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710269835615/a889e012-83a6-4d82-95e9-ce01db52067f.png align="center")
    
    **update**
    
* **how to update in SQL table**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710270500426/15f1198d-786a-4566-88e2-6dd7b3c9a9d3.png align="center")

delete in sql table

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710270839671/17b0e4a2-7841-469b-9ca8-c2e04ef897ef.png align="center")

deleting and updating anything other than primary key is not allowed

**SORTING**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710271177036/c73cfc01-b4e9-4018-89dc-9cb0f6432543.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710271243084/640a259c-2ebe-422b-94a0-b1bc9bd5777a.png align="center")

file name in vs code --&gt; data.sql
