Isabela Silva Sousa
    • 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
    # Trabalho Super Bônus | SQL autor: Isabela Silva Sousa [toc] ## Modelagem 1: Catálogo Google Play >[color=red]Create script ```sql= create table TB_Google_Play ( ID_APP int primary key auto_increment, NM_Nome varchar(100), DS_Genero varchar(100), DS_Disponivel_Apple_Store varchar(100), DS_Disponivel_Google_Play varchar(100), DT_Ultima_Atualização date, QTD_Tamanho varchar(100), NM_Criador varchar(100), DS_Avaliação decimal(10,2), QTD_Total_Avaliação varchar(100) ); ``` >[color=red] Insert script ```sql= insert into TB_Google_Play (NM_Nome, DS_Genero, DS_Disponivel_Apple_Store, DS_Disponivel_Google_Play, DT_Ultima_Atualização, QTD_Tamanho, NM_Criador, DS_Avaliação, QTD_Total_Avaliação) values ('Disney+', 'Filmes,Séries,Programas de TV', 'True', 'True', '2021-04-08', '14.41 MB', 'Disney', 4.6, '96 mil avaliações'); insert into TB_Google_Play (NM_Nome, DS_Genero, DS_Disponivel_Apple_Store, DS_Disponivel_Google_Play, DT_Ultima_Atualização, QTD_Tamanho, NM_Criador, DS_Avaliação, QTD_Total_Avaliação) values ('Sporify', 'Musicas,Podcast', 'True', 'True', '2021-04-07', '29.39 MB', 'Daniel EK e Martin Lorentzon', 4.5, '2 mil avaliações'); insert into TB_Google_Play (NM_Nome, DS_Genero, DS_Disponivel_Apple_Store, DS_Disponivel_Google_Play, DT_Ultima_Atualização, QTD_Tamanho, NM_Criador, DS_Avaliação, QTD_Total_Avaliação) values ('Uber', 'Transporte publico ,entregas', 'True', 'True', '2021-03-31', '65.00 MB', 'Travis Kalanick e Garrett Camp', 1.7, '395 mil avaliações'); ``` >[color=red] Select script ```sql= -- Consulta por quantidade, onde o campo "tamanho" esta entre 50 e 70 com valor contendo 65. select * from TB_Google_Play where QTD_Tamanho between "50.00" and "70.00"; -- Consulta por ceiling e floor. select DS_Genero, ceiling(NM_Criador), floor(NM_Criador) from TB_Google_Play; ``` ## Modelagem 2: Países >[color=red] Create script ```sql= create table TB_Países ( ID_País int primary key auto_increment, NM_Nome varchar(100), DS_Sigla varchar(100), DS_População varchar(100), DS_Área varchar(100), DT_Data_Aniversario date, DS_PIB varchar(100), NM_Continente varchar(100), NM_Capital varchar(100), DS_Idioma varchar(100) ); ``` >[color=red] Insert script ```sql= insert into TB_Países (NM_Nome, DS_Sigla, DS_População, DS_Área, DT_Data_Aniversario, DS_PIB, NM_Continente, NM_Capital, DS_Idioma) values ('Brasil', 'BR', '211 Milhões', '8.516.000 km²', '1500-04-22', '1.84 Trilhão USD', 'America do Sul', 'Brasilia', 'Português'); insert into TB_Países (NM_Nome, DS_Sigla, DS_População, DS_Área, DT_Data_Aniversario, DS_PIB, NM_Continente, NM_Capital, DS_Idioma) values ('Estados Unidos', 'EUA', '328,2 milhões', '9.834.000 km²', '1776-07-04', '21,43 trilhões USD', ' America do Norte', 'Washington, D.C.', ' Inglês'); insert into TB_Países (NM_Nome, DS_Sigla, DS_População, DS_Área, DT_Data_Aniversario, DS_PIB, NM_Continente, NM_Capital, DS_Idioma) values ('Portugal', 'PT', '10,28 milhões', '92.212 km²' , '1179-05-23', '238,8 bilhões USD', 'Europa', 'Lisboa', ' Português'); ``` >[color=red] Select script ```sql= -- Consulta por campo , onde os campos atribuidos são idioma e nome. select DS_Idioma, NM_Nome from TB_Países; -- Consulta por campo, onde os campos atribuidos são "sigla" com o valor conendo A e "continente" com o valor NÃO contendo B. select * from TB_Países where DS_Sigla like'%A%' or NM_Continente not like '%B%'; ``` ## Modelagem 3: Clube de Futebol >[color=red] Create script ```sql= create table TB_Futebol_Clube ( ID_Clube int primary key auto_increment, NM_Nome varchar(100), DS_Sigla varchar(100), NM_Pais varchar(100), NM_Cidade varchar(100), DT_Data_fundaçao date, QTD_Total_titulos int, NM_Presidente varchar(100), DS_Capacidade_estadio decimal(15,3), NM_Estadio varchar(100) ); ``` >[color=red] Insert script ```sql= insert into TB_Futebol_Clube (NM_Nome, DS_Sigla, NM_Pais, NM_Cidade, DT_Data_fundaçao, QTD_Total_titulos, NM_Presidente, DS_Capacidade_estadio, NM_Estadio) values ('Santos Futebol Clube', 'SFC', 'Brasil', 'Santos','1912-04-14', 45, 'Andrés Rueda', 20.120, 'Vila Belmiro'); insert into TB_Futebol_Clube (NM_Nome, DS_Sigla, NM_Pais, NM_Cidade, DT_Data_fundaçao, QTD_Total_titulos, NM_Presidente, DS_Capacidade_estadio, NM_Estadio) values ('Sociedade Esportiva Palmeiras','P', 'Brasil', 'São Paulo', '1914-08-26', 47, 'Mauricio Galiotte', 45.000, 'Allianz Parque'); insert into TB_Futebol_Clube (NM_Nome, DS_Sigla, NM_Pais, NM_Cidade, DT_Data_fundaçao, QTD_Total_titulos, NM_Presidente, DS_Capacidade_estadio, NM_Estadio) values ('São Paulo Futebol Clube', 'SPFC', 'Brasil', 'São Paulo', '1930-01-25', 93, 'Julio Casares', 73.501, 'Morumbi'); ``` >[color=red] Select script ```sql= -- Consulta por replace, onde uma letra é trocada por um algarismo em um certo campo. select NM_Presidente, replace(NM_Presidente, 'e','4') from TB_Futebol_Clube; -- Consulta por campo, onde o campo "cidade" tem como valor "São Paulo". select * from TB_Futebol_Clube where NM_Cidade IN ('São Paulo'); ``` ## Modelagem 4: Música >[color=red] Create script ```sql= create table TB_Musicas( ID_Musica int primary key auto_increment, NM_Nome varchar(100), NM_Artista varchar(100), DS_Album varchar(100), DS_Genero varchar(100), DT_Data_lançamento date, QTD_Total_views varchar(100), QTD_Total_likes varchar(100), TP_Duração time ); ``` >[color=red] Insert script ```sql= insert into TB_Musicas ( NM_Nome, NM_Artista, DS_Album, DS_Genero, DT_Data_lançamento, QTD_Total_views, QTD_Total_likes, TP_Duração ) values ('Kiss me more', 'Doja Cat', 'Kiss me more', 'Pop', '2021-04-09', '16 milhões', '728 mil', '00:05:18'); insert into TB_Musicas ( NM_Nome, NM_Artista, DS_Album, DS_Genero, DT_Data_lançamento, QTD_Total_views, QTD_Total_likes, TP_Duração ) values ('Streets', 'Doja Cat', 'Hot Pink', 'Pop', '2019-09-07', '51 milhões', '2 molhões', '00:04:34'); insert into TB_Musicas ( NM_Nome, NM_Artista, DS_Album, DS_Genero, DT_Data_lançamento, QTD_Total_views, QTD_Total_likes, TP_Duração ) values ('Sip', 'Iggy Azelea', 'End of an era', 'Hap', '2021-04-02', '6.9 milhões', '202 mil', '00:03:35'); ``` >[color=red] Select script ```sql= -- Consulta por campo, onde o campo "Genero" NÃO possua valor "Pop". select * from TB_Musicas where DS_Genero not like '%Pop%'; --Consulta por campo, onde o campo "total views" esteja entre 10 e 18, com o valor contendo 16. select * from TB_Musicas where QTD_Total_views between "10" and "18"; ``` ## Modelagem 5: Concessionária >[color=red] Create script ```sql= create table TB_Concessionária( ID_Carro int primary key auto_increment, NM_Marca varchar(100), DS_Modelo varchar(100), DT_Ano_modelo varchar(100), DT_Ano_de_fabricação date, DS_Possui_direção_hidraulica varchar(100), DS_Possui_ar_condicionado varchar(100), QTD_Kilometragem decimal(15,4), NM_Cor varchar(100), VL_Preço decimal(15,4) ); ``` >[color=red] Insert script ```sql= insert into TB_Concessionária (NM_Marca, DS_Modelo, DT_Ano_modelo, DT_Ano_de_fabricação, DS_Possui_direção_hidraulica, DS_Possui_ar_condicionado, QTD_Kilometragem, NM_cor, VL_preço) values ('Fiat', 'Fiat Toro', '2021', '2019-05-12', 'Possui direção hidraulica', 'Possui ar condicionado', '275.521', 'preto', '110.000'); insert into TB_Concessionária (NM_Marca, DS_Modelo, DT_Ano_modelo, DT_Ano_de_fabricação, DS_Possui_direção_hidraulica, DS_Possui_ar_condicionado, QTD_Kilometragem, NM_cor, VL_preço) values ('Fiat', 'Fiat Palio', '2012', '2011-07-09', 'Possui direção hidraulica', 'Possui ar condicionado', '15.000', 'prata', '28.000'); insert into TB_Concessionária (NM_Marca, DS_Modelo, DT_Ano_modelo, DT_Ano_de_fabricação, DS_Possui_direção_hidraulica, DS_Possui_ar_condicionado, QTD_Kilometragem, NM_cor, VL_preço) values ('Peugeot', 'Peugeot 207', '2011', '2010-10-08', 'Possui direção hidraulica', 'Possui ar condicionado', '396.000', 'prata', '19.000'); ``` >[color=red] Select script ```sql= -- Consulta por campo, onde o campo "kilometragem" contenha o valor 5. select * from TB_Concessionária where QTD_Kilometragem like '%5%'; -- Consulta por data, onde o campo "ano modelo" tenha como data 2012. select * from TB_Concessionária where DT_Ano_modelo>=2012; ``` ## Modelagem 6: Computador >[color=red] Create script ```sql= create table TB_Computadores ( ID_PC int primary key auto_increment, NM_Marca varchar(100), NM_Processador varchar(100), QTD_Memória_Ram varchar(100), QTD_Armazenamento varchar(100), DS_Sistema_Operacional varchar(100), DS_Vem_com_office varchar(100), DS_Tamanho varchar(100), VL_Preço decimal(15,2) ); ``` >[color=red] Insert script ```sql= insert into TB_Computadores (NM_Marca, NM_Processador, QTD_Memória_Ram, QTD_Armazenamento, DS_Sistema_Operacional, DS_Vem_com_office, DS_Tamanho, VL_Preço) values ('levono', 'Intel Core i3', '12GB', '1TB', 'Windows 10','Vem com office','15.6 polegadas', 2.450); insert into TB_Computadores (NM_Marca, NM_Processador, QTD_Memória_Ram, QTD_Armazenamento, DS_Sistema_Operacional, DS_Vem_com_office, DS_Tamanho, VL_Preço) values ('dell', 'i5', '4GB', '128GB', 'Windows 10', 'Vem com office', '15.6 polegadas', 2.890); insert into TB_Computadores (NM_Marca, NM_Processador, QTD_Memória_Ram, QTD_Armazenamento, DS_Sistema_Operacional, DS_Vem_com_office, DS_Tamanho, VL_Preço) values ('Asus', ' Intel Core i3', '4GB', '1TB', 'Windows 10', 'Vem com office', '15.6 polegadas', 2.999); ``` >[color=red] Select script ```sql= -- Consulta por campo, onde contenha somente os campos "memória", "sistema operacional" e "tamanho". select QTD_Memória_Ram, DS_Sistema_Operacional, DS_Tamanho from TB_Computadores; -- Consulta por replace onde uma letra é trocada por um algarismo de um certo campo. select NM_Marca, replace(NM_Marca, 'e','3') from TB_Computadores ```

    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