Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

SQL cheat sheet for learners and will be helpful in exams, Cheat Sheet of Computer science

An introduction to SQL commands and their syntax. It explains the purpose of SQL and how it is used to manage data in relational database management systems. The document covers various SQL commands such as SELECT, UPDATE, ALTER TABLE, CREATE TABLE, CREATE INDEX, and DROP TABLE. It also provides examples of each command and their syntax. useful for students studying database management systems and SQL.

Typology: Cheat Sheet

2022/2023

Available from 06/21/2023

uttamsingh1225
uttamsingh1225 🇮🇳

6 documents

1 / 7

Toggle sidebar

Related documents


Partial preview of the text

Download SQL cheat sheet for learners and will be helpful in exams and more Cheat Sheet Computer science in PDF only on Docsity! | BASIC SQL e What fs S8L? WY SOL stands for Structured Query Language - It is used for sting and managing dara in velational database management system (RDBMS) © SQL Commands : @ Select - Extract data from database. VY The data veturned ts stored in @ vesult fable , called the wesulf— Set. LicomeR (LINKED IA )- SELECT Syntax Notes GALLERY (TELEGRAM). —— | SELECT Colurnn1, Column2..... FROM table—- name, Here , column 1, Column2,.... ave the Field names of the table you want +o select dara From. IF you want fo <select all the Fields available §{n the table use the Fo\lowing Syntax ° [ serect * From table — name L aru come (LinikeDin). SELECT columns Example Cs folowing S@L statement Selects -tne “customer Name", “city! pana “country "columns from the “Customers” table : Example SELECT Customer niame, city , Countvy FROM Customers : ATUL MOK r NOTES GALLERY (receGRam) ® UPDATE Updates data in @ database. The UPDATE Srerement is used 10 modify the existing yecords jn A table. UPpaATE Syntax f UPDATE table_ name SET Columni = value, column 2 = vaqiue 2,.. WHERE Condition; Example UPDATE Customer SET Contac Name = ‘Kanth’ Clty =Fyank Furt TUL KOMI CLIN IKEDIn), ALTER TABLE — ADD column. ALTER TABLE table name APD Column— name data type Example ALTER TABLE Customer ADD Gmail Vaychar (255 ) DROP column ALTERTABLE table.nIme DRoP Column column. name ; Example ALTER TABLE Customers DROP COLUMN Emad! 3 L : NOTES GALLERY (TELEGRAM), @ CREATE TABLE Creates Q new table. The CREATE TABLE starement fs Used to create q new table in a datanase. _ Syntax CREATE TABLE table_name ( Columnt datatype » column 2 datatype , column 8 datatyre , ae Continue ap ATUL KomA (Litk Epiat)- | — example CREATE TABLE Person ( Se Persona Dee ine LactnName Vaychay (265 ), Fiyst lame Vaychay (26s J, Addyess Varchar (255 ), City Varchay (285 ) a ATUL Kum (LINKEDIN) - NOTES GALLERY (TELEGRAM) @ DROP TABLE eletes @ table. The OP TABLE statement js used to dyop an existing table in a data base. Syntax DROP TABLE table. name; Example DROP TABLE Sniprers 5 @ CREATE INDEX Creates an Index ( Search key ) The Create In étatement ig used fo Create Indexes In table. Indexes aye used to vetyive data from the data base More quiciy than Otherwise. The usevs cannot see the Indexes, they ave just used to Speed up searches / queries. Continue ——> ATUL KUMAR LUNKEDIALD. CREATE INDEx Index. name ON table. name C column 4, column], 3 CREATE INDEX Idx _ ]astname ON Pexcon( Lastnlame, First Name) ; MPR LLIN KEDIALD NOTES GALLERY (TELEGRAM), e DROP INDEX. INDEX Deletes on Index “Tne _DeoP INDEX Statement fs used to delete an index jn aq table. ALTER TABLE table_naqme. | DROP INDEX Index Name 5 ATUL KUMAR LLINKEDIAL).
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved