Giter VIP home page Giter VIP logo

1node-db1-guided-lecture's Introduction

Introduction to Relational Databases, SQL and Knex

In this project we will cover the basics of Structure Query Language (SQL), Relational Databases, and Knex.js Queries.

Prerequisites

Project Setup

  • clone this repository.
  • move into the project folder.
  • type npm i to download dependencies.

Handy Query Notes & examples

W3Schools.com

  • SELECT (lastname || ',' || firstname ) AS FullName from employees;

  • SELECT (Address || ',' || ' ' || City || ',' || ' ' || PostalCode || ',' || ' ' || Country) AS FullAddress FROM Customers;

  • SELECT * FROM Customers WHERE Country = 'Spain';

  • SELECT * FROM Customers WHERE Country LIKE 'Spain';

  • SELECT * FROM Customers WHERE Country LIKE '%land';

  • SELECT * FROM Customers WHERE Country not LIKE '%land';

  • SELECT * FROM Employees WHERE Notes not LIKE '%university%';

  • SELECT * FROM Products WHERE CategoryID = 1;

  • SELECT * FROM Orders WHERE OrderDate >'1997-01-01';

  • SELECT * FROM Orders WHERE OrderDate >'1997-01-01' ORDER BY OrderDate DESC;

  • SELECT * FROM Orders WHERE OrderDate >'1997-01-01' ORDER BY OrderDate ASC, customerID ASC;

  • 7 SELECT * FROM Products ORDER BY CategoryID ASC, Price DESC;

  • INSERT INTO Shippers (ShipperName, Phone) VALUES ('blah', '(123) 456-7890');

  • 8 INSERT INTO Shippers (ShipperName) VALUES ('UPS'); -- You have made changes to the database. Rows affected: 1 was the response and the empty phone field has null in it now

  • UPDATE Shippers SET ShipperName = 'United Parcel Service' WHERE ShipperID = 4;

  • 9 UPDATE Shippers SET ShipperName = 'USPO', Phone = '(123) 456-7890' WHERE ShipperID = 4;

  • 10 DELETE FROM Shippers WHERE ShipperID = 5; --note ID's are not recycled

1node-db1-guided-lecture's People

Contributors

rickmansfield avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.