Skip to main content

DATA BASE


 DATA BASE

Backend deals with Server and Data Base

CLOUD COMPUTING

Cloud – Cloud Computing -- Rented Computer Service

Ram, Processor, OS, Storage

WHY WE PREFER CLOUD COMPUTING

1. Capital Investment (at initial stage renting is better than purchasing)

2. Maintenance Problem (Power Backup, Hard Disk, Upgrade)

3. Easily Swappable (Scale Up & Scale Down) (festival time ecommerce need extra storage and facilities after that it may need less, College websites during exam time (E.g)  Anna university website ,recent time – income tax website – pan card & aadhar card linking)

4.  Don’t need any separate place to keep those Systems.

TOP COMPANIES

AWS – Amazon Web Service - Netflix

GCP – Google Cloud Platform

Azure - Microsoft Azure

WHY LINUX PREFERRED THAN OTHER OS

Linux, Windows, Mac

1. Open Source

2.  Secure than Windows & Mac.

3. Command Line Usage

In the Linux OS, the command line is a very handy and powerful tool used for administration and daily tasks. In Windows, ‘cmd’ command can be used to open a command line and perform a basic set of operations. It has PowerShell to make up for the limited applications of the command line.


COMMA SEPARATED VALUE (CSV)

CSV – Comma Separated Value - .csv format file - which can be opened in Excel also

Id,Username,Image

1,Priya,Img1

2,Sasi,Img2

3,Priya,Img3

4,Sasi,Img4

CSV files are stored in Hard Disk

RAM > SSD > HDD

 

 

.csv format is not valid


WHY WE NEED DATABASE

1.      DB load data in Your RAM so it’s faster (Ram --- SSD)

2.      Filtering Process (Querying),

3.      CRUD(Create Read Update Delete) ,

4.      Merge of two files (Joining)

5.      Scaling (Horizontal & Vertical)

6.      Easier to set backup process

7.      It can able to handle larger load(data quantities) than HDD,SDD

 

 

TYPES OF DATABASE

Relation vs Non Relation

SQL –Structured Query Language

Mysql

Postgres

OraclePL/SQL

RDBMS

NoSQL

Mongo DB

Cassandra

CouchDB

MariaDB


HIGHER ORDER KEY

SQL – DB, Table, Col, Row

NoSQL – DB,Collection,Document

 

Advantage of MongoDB over SQL - june 21


How to Install Mongo Database

1. https://www.mongodb.com/  

2. Try free – on premises – mongo db community server

3. Available download – set version,plattform and download

4. Start to install from the downloaded file (image files)















 

STARTING WITH MONGODB

On command prompt

mongod  & mongo

 

How to solve Mongo Db initialize error

 

Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: No connection could be made because the target machine actively refused it. :

 

Task Manager  -  Service – Mongo DB

Stopped – Right Click - Start


Show dbs / use (dbname) / db.getName()

show dbs – will display all the database in your local system

 

 use (db name)  -- If already we have the db with that particular name it will get opened  else it will create a new database with the given name

 

 db.getName()  - will display the database name in which currently we are 


 COLLECTIONS

 

show collections  (empty collections name won’t displayed) (empty collections are collections without document)

 

db.(collection name).find() ----- If already we have the collection with that particular name in the db it will get opened  else it will create a new collection with the given name

 

db.colleectionname.insertMany()  =  .”_id” :ObjectId (BSON FORMAT)


BSON FORMAT vs JSON FORMAT

Mongo db store data in BSON format

BSON Format will have addition "_id" : ObjectId("60d63a816f2152a745af4d48") line along with JSON format.


CRUD OPERATION

 Create – insertOne(), insertMany() – Copy & Paste data

Read – findOne() , findMany()

Comparison Operator - $eq ,$ne ,$in ,$nin,$gt,$gte,$lt,$lte

Logical Operator - @or,$and

Update – updateOne() , updateMany(),replaceOne() – filter and update $set

Delete – deleteone(),deleteMany()

 

drop() vs remove() vs deleteMany({})

remove() and deleteMany({}) will delete the all the documents(data) inside the collection

but drop() will delete the collection also


EXTRA COLLECTION CMD

Pretty()

sort ({userid:1,name:1})  Ascending  -({userid:-1}) Descending

limit () skip() count()

Projection Inclusion (1),exclusion (0) – Can’t mix inclusion and exclusion in the same line


REGEX

MONGO DB DATA TYPES 

SQLBOLT LESSONS

Need to check CSV format – csv fomat not valid/supported

adv of mongo over sql – june 21

how to remove duplicate

how to change order userid,name

replace One,updateMany


 


















Comments

Popular posts from this blog

CODEKATA BITWISE

Given a number N and an array of N elements, find the Bitwise XOR of the array elements. Input Size : N <= 100000 Sample Testcase : INPUT 2 2 4 OUTPUT 6   // ONE TESTCASE PASSED const   readline  =  require ( "readline" ); const   inp  =  readline . createInterface ({    input :   process . stdin }); const   userInput  = []; inp . on ( "line" , ( data )  =>  {    userInput . push ( data ); }); inp . on ( "close" , ()  =>  {    var   N  =  Number ( userInput [ 0 ]);    var   str  = String ( userInput [ 1 ])    var   arr  =  str . split ( ' ' ). map (( val ) => Number ( val ))       var   first  =  arr [ 0 ]       for ( i = 1 ; i < N ; i ++)   {  first  = first ^ arr [ i ]}    console . log ( first ...

DAY 15 - AUG 08

  DOM – DOCUMENT OBJECT MODE   HTML DOC –Browser – Browser Engine(html parser) – DOM   Tree structure takes less time for searching that’s why we prefer tree structure in DOM. Why we prefer object model? Object model means OOPS concept based it have features like data abstraction, encapsulation…. Window   -- Window is the default thing available in the Browser’s JavaScript Engine. Document -- Document is property of Window Screen – Physical dimension of   the browser   Draw some sampl tree We can create html with the help of tag and make it dynamic(to do some action) by adding   javascript   using script tag then why specifically we need this dom à Will understand in future classes that we can’t do something directly with the tag.   DOM MANIPULATION   var element =document.createElement(‘tag’) Element.setAttribute(“attribute”,”name”) If we have morethan one same attribute for the element we can’t use s...