Renato Ribeiro
    • 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
    # Super Bônus | SQL feito por: Renato Ribeiro Cardoso [toc] ## tabela 1: Modelagem Apps > Create script ```sql= CREATE TABLE tb_apps( id_apps int primary key auto_increment, nm_app varchar(200), nm_criador varchar(200), ds_genero varchar(200), ds_tamanho varchar(200), ds_avaliacao decimal(15,2), bt_disponivel_AP bool, bt_disponivel_PS bool, qtd_downloads int ); ```` >Insert script ```sql= INSERT INTO tb_apps (nm_app, nm_criador, ds_genero, ds_tamanho, ds_avaliacao, bt_disponivel_AP, bt_disponivel_PS, qtd_downloads) VALUES ("COMO GANHAR 3 PONTOS", "RVZIN du mal", "entreterimento", "3GB", 5.0, false, true, 260), ("Facebook", "Mark Zukerbeg", "Social", "2GB", 4.2, true, true, 1000000000), ("Instagram", "Kevin Systrom", "Social", "1GB", 4.5, true, true, 1000000000); ```` > Select script ```sql= -- Consulta por avaliação maior que 4, além de disponivel. SELECT * FROM tb_apps WHERE ds_avaliacao > 4.0 AND bt_disponivel_PS = true; - Consulta por capacidade de armazenamento maior ou igual e ordenar de forma decrescente SELECT * FROM tb_apps WHERE ds_tamanho >= "3GB" ORDER BY ds_avaliacao DESC; ``` ### tabela 2: Modelagem Paises . Create script ```sql= CREATE TABLE TB_modelagem_países( id int primary key auto_increment, DT_Data_Aniversário date, NM_Nome varchar(200), VL_PIB varchar(100), DS_Continente varchar(200), DS_Sigla varchar(100), DS_Capital varchar(100), QTD_Populaçao varchar(100), DS_Idioma varchar(100), VL_Àrea varchar(100) ); ```` >insert script ```sql= INSERT INTO TB_modelagem_países (DT_Data_Aniversário, NM_Nome, VL_PIB, DS_Continente, DS_Sigla, DS_Capital, QTD_Populaçao, DS_Idioma, VL_Àrea) VALUES ("1500-01-22", "Brasil", "U$ 603,4 bilhões", "america do sul", "BR", "Brasilia", "211 milhões (2019)", "Portugues", "8.516.000 km²"), ("1945-08-17", "Indonesia", "1,119 trilhão USD", "Ásia", "ID", "Jacarta", " 270,6 milhões (2019)", "Indonesio", "1.905.000 km²"), ("1959-08-27", "Hawaii", "US$ 93,419 bilhões", "America do norte", "HI", "Honolulu", "1,416 milhão (2019)", "havaiano", "28.311 km²");] ``` > Select script ```sql= -- Consulta por nomes que possuem vogal. SELECT * FROM TB_modelagem_países WHERE NM_Nome LIKE 'A%' OR NM_Nome LIKE 'E%' OR NM_Nome LIKE 'I%' OR NM_Nome LIKE 'O%' OR NM_Nome LIKE 'U%'; -- Consulta por nome do pais + sua area, mostrar caso for maior ou igual. SELECT NM_Nome, VL_Àrea FROM TB_modelagem_países WHERE VL_Àrea >= 8.000; ``` #### tabela 3: Modelagem Clube De Futebol > Create script ```sql= CREATE TABLE TB_Modelagem_Clube_Futebol ( id int primary key auto_increment, DT_Data_Fundação date, VL_Total_Titulos int, NM_Nome varchar(100), DS_Descrição varchar(200), DS_Sigla varchar(100), QTD_Capacidade_Estádio decimal(15,3), DS_Pais varchar(100), DS_Estadio varchar(100), DS_Cidade varchar(100) ); ```` insert script ```sql= INSERT INTO TB_Modelagem_Clube_Futebol(DT_Data_Fundação, VL_Total_Titulos, NM_Nome, DS_Descrição, DS_Sigla, QTD_Capacidade_Estádio, DS_Pais, DS_Estadio, DS_Cidade) VALUES ("2004-03-02", 25, "Ninjinhas do frenex", "time fundado pelo instituto, com a intenção de melhor socialidade dos alunos", "NF", 65.200, "Brasil", "Estadio do Software", "São Paulo"), ("1914-08-26", 15, "Sociedade Esportiva Palmeiras", "A Sociedade Esportiva Palmeiras é um clube poliesportivo brasileiro da cidade de São Paulo, capital do estado homônimo.", "SEP", 55.000, "Brasil", "Allianz Parque", "São Paulo"), ("1970-08-12", 20, "Paris Saint-Germain Football Club", "O Paris Saint-Germain Football Club, também conhecido como Paris Saint-Germain ou pela sua sigla, é um clube de futebol profissional da França, com sede em Paris.", "PSG", 47.929, "Paris", "Estádio Parc des Princes", "França"); ``` > Select script ```sql= -- Consulta por nome/titulos/fundação com as iniciais ordenando de forma crescente, os titulos. SELECT NM_Nome, VL_Total_Titulos, DT_Data_Fundação FROM TB_Modelagem_Clube_Futebol WHERE NM_Nome LIKE 'N%' OR NM_Nome LIKE 'S%' OR NM_Nome LIKE 'P%' ORDER BY VL_Total_Titulos ASC; -- Consulta por data entre 01/01/1914 e 31/12/2004. SELECT * FROM TB_Modelagem_Clube_Futebol WHERE DT_Data_Fundação BETWEEN '1914-01-01' AND '2004-12-31'; ``` ##### tabela 4: Modelagem Musica >Create script ```sql= CREATE TABLE TB_Modelagem_Musica( id int primary key auto_increment, DT_Data_Lançamento date, DS_Nome varchar(100), VL_Total_Views decimal(15,3), DS_artista varchar(100), VL_Total_Likes decimal(15,3), DS_Album varchar(100), DS_Duração decimal(15,2), DS_Genero varchar(100) ); ```` >insert script ```sql= INSERT INTO TB_Modelagem_Musica(DT_Data_Lançamento, DS_Nome, VL_Total_Views, DS_artista, VL_Total_Likes, DS_Album, DS_Duração, DS_Genero) VALUES ("2021-09-04", "Aka Rasta, Burn-O - Não Vou Mais Em Festas", 212.458, "AKA RASTA", 18.000, "Não mencionado", 02.40, "TRAP"), ("2020-03-14", "16 - Yunk Vino - Fim", 1665.462, "Yunk Vino", 27000, "MIXTAPE 237", 03.05, "TRAP"), ("2016-03-30", "Froid - Pseudosocial", 32034.265, "Froid", 333000, "Não mencionado", 02.16, "RAP"); ``` > Select script ```sql= -- Consulta por genero da musica "TRAP", ordenando pelo valor total de views. SELECT * FROM TB_Modelagem_Musica WHERE DS_Genero IN ('TRAP') ORDER BY VL_Total_Views DESC; -- Consulta por meses e dias, ordem crescente sob lançamentos. SELECT * FROM TB_Modelagem_Musica WHERE month(DT_Data_Lançamento) IN (9,2,3) ORDER BY DT_Data_Lançamento ASC; ``` ##### tabela 5: Modelagem Concessionaria >Create scripts ```sql= CREATE TABLE TB_Modelagem_Concessionaria( id int primary key auto_increment, DS_Possui_Direção_Hidraulica varchar(100), DS_Modelo varchar(100), DS_Possui_Ar_Condicionado varchar(100), DS_Marca varchar(100), VL_Kilometragem int, VL_Preço decimal(15,3), DT_Ano_Fabricação year, DS_Cor varchar(100), DT_Ano_Modelo year ); ``` >create insert ```sql= INSERT INTO TB_Modelagem_Concessionaria (DS_Possui_Direção_Hidraulica, DS_Modelo, DS_Possui_Ar_Condicionado, DS_Marca, VL_Kilometragem, VL_Preço, DT_Ano_Fabricação, DS_Cor, DT_Ano_Modelo) VALUES ("SIM", "Hyundai HB20", "SIM", "Hyundai", 1000, 58.890, "2012", "Branco Gelo", "2021"), ("NÂO", "Gol bolinha", "SIM", "Volkswagen", 30000, 7.896, "1980", "Cinza claro", "1980"), ("SIM", "Ford Fiesta", "SIM", "Ford", 15000, 21.990, "2010", "platinado", "2014"); ``` > Select script ```sql= -- Consulta por ano(date), sendo que se possuir resultado maior ou igual ordenar em forma decrescente. SELECT * FROM TB_Modelagem_Concessionaria WHERE DT_Ano_Fabricação >= '1980' ORDER BY DT_Ano_Fabricação DESC; -- Consulta por inciais das industrias com kilometragem entre. SELECT * FROM TB_Modelagem_Concessionaria WHERE DS_Marca LIKE 'H%' OR DS_Marca LIKE 'V%' OR DS_Marca LIKE 'F%' OR VL_Kilometragem BETWEEN 1000 and 15000; ``` ###### tabela 6: Modelagem Computador >create scripts ```sql= CREATE TABLE TB_Modelagem_Computador( id int primary key auto_increment, DS_Sistema_Operacional varchar(100), DS_Marca varchar(100), DS_Vem_Com_Office varchar(100), DS_Processador varchar(100), DS_Tamanho decimal(15,1), DS_Memoria_RAM varchar(100), DS_Armazenamento varchar(100), VL_Preço decimal(15,3) ); ``` >create insert ```sql= INSERT INTO TB_Modelagem_Computador(DS_Sistema_Operacional, DS_Marca, DS_Vem_Com_Office, DS_Processador, DS_Tamanho, DS_Memoria_RAM, DS_Armazenamento, VL_Preço) VALUES ("Windows", "SAMSUNG", "SIM", "Intel Core I5", 53.1, "HyperX Fury 8GB", "500GB", 3.500), ("Mac OS X", "APPLE", "NÃO", "Intel Core I7", 56.2, "XPG Spectrix 8GB", "1TB", 10.600), ("Linux", "SAMSUNG", "SIM", "Intel Core I4", 52.4, "Ballistix Sport LT 16GB", "250GB", 2.000); ``` > Select script ```sql= -- Consulta por marca que nao contenham 'M'. SELECT * FROM TB_Modelagem_Computador WHERE DS_Marca NOT LIKE '%M%'; -- Consulta por tamanho entre. SELECT * FROM TB_Modelagem_Computador WHERE DS_Tamanho BETWEEN 50.1 AND 56.2; ```

    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