Inspiration

mlh local hackday

What it does

lets say we are working on table named customers customer table schema -> (customerid,customername,contactno,address,city,postalcode,country)

  • selecting customername and customerid from table select customerid,customername from customers;
  • selecting all records from a table select * from customers;
  • using where clause in select query select * from customers where city = 'Mumbai';

    - using distinct keyword in sql query
    

    select distinct customerid from customers where city = 'Mumbai';

  • using order by in select statement

    select * from customers order by customername;
    
  • using and keyword in select statement

    select * from customers where city = 'Mumbai' and postalcode = '401229';
    
  • inserting a record in table

    insert into customers values(1,'abc',123456,'demo address','mumbai',401229,'India');
    
  • updating a record in table customers update customers set customername = 'abcd' where customerid = 1;
  • deleting a record in table customers

    delete from customers where customername = 'abcd' and address = 'demo address';
    
  • using group by and aggregate functions

    SELECT COUNT(CustomerID), Country
    FROM Customers
    GROUP BY Country;
    
  • using having clause with groupby

    SELECT COUNT(CustomerID), Country
    FROM Customers
    GROUP BY Country
    HAVING COUNT(CustomerID) > 5
    ORDER BY COUNT(CustomerID) DESC;
    

    Challenges we ran into

    sql queries

    Accomplishments that we're proud of

    learnt sql queries

    What we learned

    sql

Built With

Share this project:

Updates