Carol Campos
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ### INFO B - Caroline Campos Lima, 04 # B.D Final Session: It's all or nothing [toc] ## Modelagem 1: Catálogo Google Play > Create Script ```sql= CREATE TABLE tb_apps ( id int primary key auto_increment, nm_app varchar(100), tp_genero varchar(100), bt_play_store bool, bt_google_play bool, dt_ultima_atualizaçao date, nr_tamanho decimal(10, 2), nm_criador varchar(100), nr_avaliaçao decimal(10, 2), qnt_downloads int ); ``` > Insert Script ```sql= INSERT INTO tb_apps (nm_app, tp_genero, bt_play_store, bt_google_play, dt_ultima_atualizaçao, nr_tamanho, nm_criador, nr_avaliaçao, qnt_downloads) VALUES ('Call Of Dull', 'Jogo', true, true, '2021-02-09', 2.9, 'Treyarch', 4.7, 300000000), ('Facebook', 'Rede Social', true, true, '2021-04-03', 253.4, 'ArkZuckerberg', 2.7, 250000000), ('Instagream', 'Rede Social', true, true, '2021-03-29', 159.5, 'Kevin Systrom', 4.8, '1000000000.4'); ``` > Select Script ```sql= -- Consulta por apps que começam com F e que tem a avaliação menor que 4,0 SELECT * FROM tb_apps WHERE nm_app LIKE ('F%') AND nr_avaliaçao < 4.0; -- Consulta por app que tem como gênero rede social SELECT * FROM tb_apps WHERE tp_genero LIKE '%Rede Social%'; ``` ## Modelagem 2: Países > Create Script ```sql= CREATE TABLE tb_pais ( id int primary key auto_increment, nm_pais varchar(100), ds_sigla varchar(100), qnt_populaçao varchar(100), nr_area decimal(10, 2), dt_aniversario date, vl_PIB varchar(100), nm_continente varchar(100), nm_capital varchar(100), tp_idioma varchar(100) ); ``` > Insert Script ```sql= INSERT INTO tb_pais (nm_pais, ds_sigla, qnt_populaçao, nr_area, dt_aniversario, vl_PIB, nm_continente, nm_capital, tp_idioma) VALUES ('Brasil', 'BR', '211.8 milhões', 8516000, '1500-04-22', '1,84 trilhão ','America do Sul ' , 'Brasilia', 'Portugues'), ('Alemanha', 'DE', '83,02 milhões', 357386, '1871-01-18', '3,861 trilhões','Europa' , 'Berlin', 'Alemão'), ('Estados Unidos', 'US', '328,2 milhões', 9834000, '1776-07-04', '21,43 trilhões ','America do Norte' , 'Washington', 'Ingles'); ``` > Select Script ```sql= -- Consulta por países em que sua área é maior ou igual que 5000000 SELECT * FROM tb_pais WHERE nr_area >= 5000000; -- Consulta por países em que sua capital começa com B SELECT * FROM tb_pais WHERE nm_capital LIKE 'B%'; ``` ## Modelagem 3: Clube Futebol > Create Script ```sql= CREATE TABLE tb_ClubeFutebol ( id int primary key auto_increment, nm_time varchar(100), ds_sigla varchar(100), nm_pais varchar(100), nm_cidade varchar(100), nm_estadio varchar(100), qtd_capacidade decimal(10, 2), nm_presidente varchar(100), qtd_titulos int, dt_fundacao date ); ``` > Insert Script ```sql= INSERT INTO tb_ClubeFutebol (nm_time, ds_sigla, nm_pais, nm_cidade, nm_estadio, qtd_capacidade, nm_presidente, qtd_titulos, dt_fundacao) VALUES ('Palmeiras', 'SEP', 'Brasil', 'São Paulo', 'Allianz Parque', 55000, 'Maurício Galliote', 19, '1914-08-26'), ('Internacional', 'SCI', 'Brasil', 'Porto Alegre', 'Beira-Rio', 50842, 'Alessandro Barcellos', 11, '1909-04-04'), ('Real Madrid', 'RMCS', 'Espanha', 'Madrid', 'Santiago Bernabéu', 81044, 'José Ángel Sánchez', 34, '1902-03-06'); ``` > Select Script ```sql= -- Consulta por clubes que tem a capacidade de estádio maior ou igual que 52000 e que são ordenados por ordem decrescente SELECT * FROM tb_ClubeFutebol WHERE qtd_capacidade >= 52000 ORDER BY nm_time DESC; -- Consulta por clubes em que a sigla começa com S SELECT * FROM tb_ClubeFutebol WHERE ds_sigla LIKE 'S%'; ``` ## Modelagem 4: Música > Create Script ```sql= CREATE TABLE tb_musica ( id int primary key auto_increment, nm_musica varchar(100), nm_artista varchar(100), nm_album varchar(100), nm_genero varchar(100), dt_lançamento date, qnt_total_views varchar(100), qnt_likes varchar(100) , hr_tempo time ); ``` > Insert Script ```sql= INSERT INTO tb_musica (nm_musica, nm_artista, nm_album, nm_genero, dt_lançamento, qnt_total_views, qnt_likes, hr_tempo) VALUES ('Perdição', 'L7NNON', 'HHR', 'Rap', '2019-07-22', '105.986.333', '1Milhão','4:35'), ('Facas', 'Diego e Victor Hugo', 'Equilibrio', 'Sertanejo Universitário', '2020-09-16', '175.173.483', '988Mil','3:18'), ('Partilhar', 'Rubel', 'Casas', 'MPB', '2019-11-11', '44.124.336', '587Mil','7:02'); ``` > Select Script ```sql= -- Consulta por músicas que tem o gênero rap SELECT * FROM tb_musica WHERE nm_genero = 'rap'; -- Consulta por músicas que foram lançadas no ano de 2020 SELECT * FROM tb_musica WHERE dt_lançamento BETWEEN '2020-01-01' AND '2020-12-31'; ``` ## Modelagem 5: Concessionária > Create Script ```sql= CREATE TABLE tb_carro ( id int primary key auto_increment, tp_modelo varchar (100), nm_marca varchar (100), nr_fabricacao int, nr_modelo int, ds_cor varchar (100), vl_preco decimal (10, 2), nr_kilometragem decimal (10, 2), bt_ar_condicionado bool, bt_direcao_hidraulica bool ); ``` > Insert Script ```sql= INSERT INTO tb_carro (tp_modelo, nm_marca, nr_fabricacao, nr_modelo, ds_cor, vl_preco, nr_kilometragem, bt_ar_condicionado, bt_direcao_hidraulica) VALUES ('Siena Tetrafuel', 'Fiat', 2009, 2010, 'Branco', 16000.00, 210000, true, true), ('Toro Ultra', 'Fiat', 2021, 2021, 'Vermelho', 102294.80, 2800, true, true), ('A6 Sedan', 'Audi', 2020, 2020, 'Verde Avalon', 419990.00, 5000, true, true); ``` > Select Script ```sql= -- Consulta pelos campos id, modelo, marca, cor e preço onde a cor começar com a letra V SELECT id, tp_modelo, nm_marca, ds_cor, vl_preco FROM tb_carro WHERE ds_cor LIKE 'V%'; -- Consulta por carros que são da marca Fiat SELECT * FROM tb_carro WHERE nm_marca IN ('Fiat'); ``` ## Modelagem 6: Computador > Create Script ```sql= CREATE TABLE tb_computador ( id_computador int primary key auto_increment, nm_marca varchar (100), tp_processador varchar (100), tp_sistema_operacional varchar (100), qtd_memoriaRAM varchar (100), qtd_armazenamento varchar (100), bt_office bool, ds_tela decimal (10, 2), vl_preco decimal (10, 2) ); ``` > Insert Script ```sql= INSERT INTO tb_computador (nm_marca, tp_processador, tp_sistema_operacional, qtd_memoriaRAM, qtd_armazenamento, bt_office, ds_tela, vl_preco) VALUES ('Dell', 'Intel Core i5', 'Windows 10', '8GB', '500GB', true, 28.05, 4938.10), ('Quantum', 'Intel Core i5', 'Linux', '8GB', '2TB', true, 19.5, 2102.32), ('Quantum', 'Intel Core i5', 'Linux', '8GB', '1TB', false, 19.7, 2287.9); ``` > Select Script ```sql= -- Consulta por computadores que são da marca Quantum ou que tem o preço menor ou igual a 3000 SELECT * FROM tb_computador WHERE nm_marca = 'Quantum' OR vl_preco <= 3000; -- Consulta por computadores que possuem processador da Intel independente de que tipo da Intel e que tem o sistema operacional da Windows 10 SELECT * FROM tb_computador WHERE tp_processador LIKE 'Intel%' AND tp_sistema_operacional IN ('Windows 10'); ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully