GithubHelp home page GithubHelp logo

tpsitslideshow's Introduction

Welcome to Slidev!

To start the slide show:

Edit the slides.md to see the changes.

Learn more about Slidev on documentations.

AJAX, SQL e NOSQL

Fatto da Marano Andrea

Cos'è AJAX?

AJAX è un'insieme di tecniche che consentono di inviare richieste HTTP asincrone ad un webserver.

sequenceDiagram
    Browser-)Server: Richiesta HTTP (GET, POST, ecc.)
    Server-)Browser: Risposta in formato XML, JSON, HTML, ecc.

Esempi di utilizzo di AJAX

XHR - XMLHttpRequest

XMLHttpRequest è un oggetto utizzabile in vanilla JavaScript per effettuare richieste HTTP asincrone.

const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
  }
};
xhttp.open("GET", "form.php", true);
xhttp.send();

jQuery

$.ajax({
  url: "form.php",
  type: "GET",
  success: function(result) {
  }
});

Database

Un database è un archivio di dati che permette di organizzare, gestire e recuperare informazioni.

Tipologie di database

  • SQL - Relazionale
  • NOSQL - Non relazionale

SQL - Structured Query Language

SQL è un linguaggio standardizzato per interrogare e gestire i dati contenuti in un database relazionale.

PHP

In PHP è possibile utilizzare la libreria MySQLi per connettersi ad un database MySQL.

$conn = new mysqli($servername, $username, $password, $dbname);

$stmt = $conn->prepare("SELECT nome FROM Utenti WHERE cognome=?");
$stmt->bind_param("s", $lastname);

$nome = "";
$lastname = "Rossi";
$stmt->execute();

$stmt->bind_result($nome);

$stmt->close();
$conn->close();

NoSQL - Not Only SQL

NoSql è un tipo di database che permette di archiviare e recuperare dati senza dover definire la struttura dei dati stessi.

Vantaggi

  • Maggiore flessibilità per i dati non normalizzati
  • Scalabilità per elevate quantità di dati
  • Semplicità di gestione (es. attraverso REST API)

Svantaggi

  • Mancanza di standardizzazione
  • Mancanza di integrità referenziale
  • Ogni database ha la sua sintassi
  • Non è possibile effettuare JOIN tra entità

Esempio di tabella SQL e documento NoSQL

SQL

CREATE TABLE Utenti (
  id INTEGER AUTO_INCREMENT PRIMARY KEY,
  nome VARCHAR(50) NOT NULL,
  cognome VARCHAR(50) NOT NULL,
  indirizzo VARCHAR(100) NOT NULL
);

NoSQL

{
  "nome": "Mario",
  "cognome": "Rossi",
  "indirizzo": {
    "via": "Via Roma",
    "civico": "1",
    "città": "Milano"
  }
}

tpsitslideshow's People

Contributors

lumarans30 avatar marinaccialessio 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.