0% found this document useful (0 votes)
54 views10 pages

Coding Notes

The document provides information on JavaScript, jQuery, SQL, and Ruby. Some key points: - JavaScript code is inserted between <script> tags and functions execute when events occur or called. Scripts can be in external .js files. - SQL is a language for accessing and manipulating databases. Important commands include SELECT, UPDATE, DELETE, CREATE and DROP. The WHERE clause filters records and AND/OR operators combine conditions. - jQuery makes JavaScript easier by selecting and manipulating HTML elements with $() and common actions. It can be included from a CDN or downloaded file. - Ruby has three basic data types - strings, booleans, and numbers. Objects are fundamental elements that can represent various

Uploaded by

Serge Gelin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views10 pages

Coding Notes

The document provides information on JavaScript, jQuery, SQL, and Ruby. Some key points: - JavaScript code is inserted between <script> tags and functions execute when events occur or called. Scripts can be in external .js files. - SQL is a language for accessing and manipulating databases. Important commands include SELECT, UPDATE, DELETE, CREATE and DROP. The WHERE clause filters records and AND/OR operators combine conditions. - jQuery makes JavaScript easier by selecting and manipulating HTML elements with $() and common actions. It can be included from a CDN or downloaded file. - Ruby has three basic data types - strings, booleans, and numbers. Objects are fundamental elements that can represent various

Uploaded by

Serge Gelin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

JAVASCRIPT

Whereto
JavaScriptcodemustbeinsertedbetween<script>and</script>tags.
Functionsareblocksofcodesthatcanbeexecutedwhenaskedfor.
o Afunctioncanbeexecutedwhenaneventoccurs.
Scriptscanbeplacedinexternalfiles;JavaScriptfilescanbesavedwiththe.jsextension.
JavaScriptOutput
Writeintoanalertboxusingwindow.alert()
WriteintotheHTMLoutputusingdocument.write()
WriteintoanHTMLelement,usinginnerHTML.
Writeintothebrowserconsole,usingconsole.log().
JavaScriptSyntax
JavaScriptsyntaxdefinestwovalues:Fixedvaluesandvariablevalues.
o Fixedvaluesarecalledliterals.
Numbersarewrittenwithorwithoutdecimals.
Stringsaretexts,writtenwithdoubleorsinglequotes.
o VariablevaluesarecalledvariablesUsedtostoredatavalues.
Usesthevarwordtodeclarevariables.
Anequalsignisusedtoassignvaluestovariables.
JavaScriptusesanassignmentoperator(=)toassignvaluestovariables.
JavaScriptISCASESENSITIVE.
JavaScriptStatements
Instructionssenttobeexecuted.
Semicolons(;)separatestatements.
JavaScriptVariables
Variablesarecontainersforstoringdatavalues.
AllJavaScriptvariablesmustbeidentifiedwithuniquenames.
JavaScriptStrings
JavaScriptstringsareusedforstoringandmanipulatingtexts.
JavaScriptDates

JavaScriptDateFormats
TherearefourtypesofJavaScriptdateinputformats:
o Isodate20150325
o Shortdate"03/25/2015"or"2015/03/25"
o Longdate"Mar252015"or"25Mar2015"
o Fulldate"WednesdayMarch252015"
JavaScriptDateMethods

JavaScriptArrays
JavaScriptarraysareusedtostoremultiplevaluesinasinglevariable.
TocreateaJavaScriptarray:
o Syntax:vararrayname:=[item1,item2,]
Anarrayelementbyreferringtotheindexnumber.
o [0]Isthefirstelementinanarray.[1]Isthesecondelementinanarray.
JavaScriptBooleans
JavaScriptbooleansrepresentsoneoftwovalues:trueandfalse.
ObjectDefinitions
InJavaScript,almosteverythingisanobject:
o Booleanscanbeobjects.
o Numberscanbeobjects.
o Stringscanbeobjects.
o DatesareALWAYSobjects.
o MathsisALWAYSobjects.
Thenamedvalues,inJavaScriptobjects,arecalledproperties.

JQUERY
JQueryIntro
MakesitmucheasiertouseJavaScriptonawebsite.
TheJQuerylibraryisasingleJavaScriptfile,andyoureferenceitwiththeHTML<script>tag
(whichshouldbeintheheadsection):
<Head>
<Scriptsrc=jquery3.1.1.min.js></script>
</head>
IfyoudontwanttodownloadandhostJQuery,youcanincludeitfromaCDN(ContentDelivery
Network).TousethequeryfromGoogle,use:
o <Scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
JQuerySyntax
Thebasicsyntaxis:$(selector).action()
o

A$signtodefine/accessjQuery

A(selector)to"query(orfind)"HTMLelements

AjQueryaction()tobeperformedontheelement(s)

JQuerySelectors
AllowsyoutoselectandmanipulateHTMLelements;alltheselectorsstartwith$().

SQL
Introduction
SQLstandsforstructuredquerylanguage.
Itletsyouaccessandmanipulatedatabases.
Tobuildawebsitethatshowsdatafromadatabaseyouwillneed:
o RDMBSdatabaseprogram(MySQL,SQLserver,Oracle,MSaccess,IBMDB2)
o UseaserversidescriptinglanguagelikePHPorASP.
o UseHTML/CSS
RDBMSisthebasisforSQL;thedatainRDBMSisstoredindatabaseobjectscalledtables.
o Atableisacollectionofrelateddataentriesanditconsistsofcolumnsandrows.
Syntax
SQLkeywordsARENOTcasesensitive.
SemicolonsarethestandardwaytoseparateeachSQLstatement.
ImportantSQLcommands
o SELECTExtractsdatafromadatabase.
o UPDATEUpdatesdatainthedatabase.
o DELETEDeletesdatafromdatabase.
o CREATEDATABASECreatesanewdatabase.
o ALTERDATABASEModifiesdatabase.
o DROPTABLEDeletestables.
o CREATEINDEXCreatesanindex.
o DROPINDEXDeletesanindex.
SQLSelectStatement
TheSELECTstatementisusedtoselectdatafromadatabase.
o Theresultisstoredinaresulttable,calledtheresultset.
SQLSelectsyntax:SELECTcolumn_name,column_nameFROMtable_name;
SQLSelectDistinctStatements
Theselectdistinctstatementsareusedtoreturnonlydistinctvalues.
SQLSelectdistinctsyntax:SELECTDISTINCTcolumn_name,column_nameFROM
table_name;
SQLWhereClause
Thewhereclauseisusedtoextractonlythoserecordsthatfulfillaspecifiedcriterion.
SQLWheresyntax:SELECTcolumn_name,column_nameFROMtable_nameWHERE
column_nameoperatorvalue;
SQLAnd&OROperators
TheAND&ORoperatorsareusedtofilterrecordsbasedonmorethanonecondition.
TheANDoperatordisplaysarecordifboththefirstconditionandsecondconditionaretrue.
TheORoperatordisplaysarecordifeitherthefirstconditionORsecondconditionaretrue.
SQLorderbysyntax:SELECTcolumn_name,column_nameFROMtable_nameORDER
BYcolumn_nameASC|DESC,column_nameASC|DESC;
SQLInsertIntoStatement

Theinsertintostatementisusedtoinsertnewrecordsinatable.
ItispossibletowritetheINSERTINTOstatementintwoforms:
o Thefirstformdoesnotspecifythecolumnnameswherethedatawillbeinserted,only
theirvalues:INSERTINTOtable_nameVALUES(value1,value2,value3,...);
Thesecondformspecifiesboththecolumnnamesandthevaluestobeinserted:INSERT
INTOtable_name(column1,column2,column3,...)VALUES(value1,value2,value3,...);

SQLUpdateStatement
Theupdatestatementisusedtoupdaterecordsinatable.
SQLupdatesyntax:UPDATEtable_nameSETcolumn1=value1,column2=value2,...
WHEREsome_column=some_value;
SQLDeleteStatement
Thedeletestatementisusedtodeleterowsinatable.
SQLdeletesyntax:DELETEfromtable_nameWHEREsome_column=some_value;
SQLInjection
AnSQLinjectioncandestroyyourdatabase.
SQLTopClause
TheSELECTTOPclauseisusedtospecifythenumberofrecordstoreturn.
TopClausesyntax:SELECTTOPnumber|percentcolumn_name(s)
FROMtable_name;

SQLFUNCTIONS
SQLFunctions
SQLAggregatefunctionsreturnasinglevalue,calculatedfromvaluesinacolumn.

AVG()Returnstheaveragevalue

COUNT()Returnsthenumberofrows

FIRST()Returnsthefirstvalue

LAST()Returnsthelastvalue

MAX()Returnsthelargestvalue

MIN()Returnsthesmallestvalue

SUM()Returnsthesum

SQLScalarfunctionsreturnasinglevalue,basedontheinputvalue.
o

UCASE()Convertsafieldtouppercase

LCASE()Convertsafieldtolowercase

MID()Extractcharactersfromatextfield

LEN()Returnsthelengthofatextfield

ROUND()Roundsanumericfieldtothenumberofdecimalsspecified

NOW()Returnsthecurrentsystemdateandtime

FORMAT()Formatshowafieldistobedisplayed

SQLAVG()Functions
Returnstheaveragevalueofanumericcolumn.
SQLAVG()Syntax:SELECTAVG(column_name)FROMtable_name
SQLCOUNT()Functions

Returnsthenumberofrowsthatmatchesspecifiedcriteria.
SQLCOUNT(column_name)Syntax:SELECTCOUNT(column_name)FROMtable_name;

SQLCOUNT(*)Syntax:

SQLNow()Function
Thefunctionreturnsthecurrentsystemdateandtime.
SQLNOW()Syntax:SELECTNOW()FROMtable_name;
SQLFormat()Function
Itisusedtoformathowafieldistobedisplayed.
SQLFormat()Syntax:SELECTFORMAT(column_name,format)FROMtable_name;

RUBY
ThreeDatatypesinRUBY
1. Strings
2. Booleans
3. Numbers
Whatisanobject?!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy