Git Product home page Git Product logo

sql-ddl-dml-dql's Introduction

SQL BASICS (DDL, DML, DQL)

  • Creating simple college database using SQL.

Table of contents

Overview

Screenshot

image

Links

My process

Built with

What I learned

  • Use Data Definition Language (DDL) subset of SQL to CREATE, ALTER OR DROP Database / Table.
  • a) CREATE statement
  • b) ALTER statement
  • Use Data Manipulation Language (DML) subset of SQL to POPULATE (INSERT), UPDATE, DELETE records from a Table.
  • a) UPDATE statement
  • b) DELETE statement
  • Use Data Query Language (DQL) subset of SQL to SELECT/ QUERY records from a Table.
  • a) SELECT statement
  • Add Primary key to a relational database

Here is a code snippet:

INSERT INTO student_tbl(ID, first_name, last_name, home_address, college_address, contact_number, department)
VALUES
(1, "John", "Murphy", "111 Park Street", "Stafford Building", "7654567632", "science"),
(2, "Sandra", "Hauge", "256 Stafford Street", "Stafford Building", "7634567652", "science"),
(3, "Jerry", "Millar", "222 Green Gardens", "Stafford Building", "7623951287", "science"),
(4, "Heather", "Dawson", "255 Lincoln Street", "Grand Building", "7629845645", "enginerring"),
(5, "Ryan", "Egan", "300 Grand Avenue", "Grand Building", "7649237645", "enginerring");

ALTER TABLE student_tbl
ADD PRIMARY KEY (ID);

UPDATE student_tbl
SET home_address = "234 Park Avenue", contact_number = "2345556767"
WHERE ID = 3;

UPDATE student_tbl
SET department = "engineering"
WHERE college_address = "Grand Building";

DELETE FROM student_tbl
WHERE ID = 3;

Useful resources

  • w3schools - This helped me for using SQL syntax.
  • w3school - This helped me for adding primary key to a database.

Author

sql-ddl-dml-dql's People

Contributors

marventures avatar

Stargazers

 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.