This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exemplo; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
public class Principal { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE WorldEvents; | |
GO | |
-- 1. Crie uma stored procedure chamada uspCountriesAsia que liste todos os países com ContinentId igual a 1, | |
-- em ordem alfabética. | |
CREATE PROCEDURE uspCountriesAsia | |
AS | |
SELECT CountryName from tblCountry WHERE ContinentID = 1 ORDER BY CountryName | |
EXEC uspCountriesAsia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Variáveis de Tabela | |
-- são variáveis que permitem armazenar linhas, como tabelas temporárias | |
-- podem ser declaradas com o comando DECLARE: | |
/* | |
DECLARE @table_variable_name TABLE ( | |
column_list | |
); | |
*/ | |
-- Essas variáveis perdem o escopo no fim do script | |
-- se definida em uma função ou procedure ela deixa de existir após |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Funções Escalares | |
-- recebem um ou mais parâmetros e retornam um único valor | |
-- ajudam a simplificar o código | |
-- um cálculo complexo que aparece em várias consultas pode ser | |
-- encapsulado em uma função escalar | |
-- podemos criar uma função com o comando CREATE FUNCTION | |
CREATE FUNCTION sales.udfNetSale( -- nome da função c/ schema name opcional | |
@quantity INT, -- lista de parâmetros entre parênteses | |
@list_price DEC(10,2), -- após o nome da função | |
@discount DEC(4,2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- declara-se uma variável com a palavra-chave DECLARE | |
-- @nome_da_variavel TIPO | |
DECLARE @model_year SMALLINT; | |
-- a palavra chave AS é opcional | |
DECLARE @model_year AS SMALLINT; | |
-- múltiplas variáveis podem ser declaradas separadas por | |
-- vírgulas | |
DECLARE @model_year SMALLINT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- uma procedure pode ter vários parâmetros de saída e eles podem ser | |
-- de qualquer tipo de dados: int, date, varchar .... | |
-- por exemplo: encontrar produtos por ano e retornar o número de produtos | |
-- através do parâmetro @product_count | |
CREATE PROCEDURE uspFindProductByModel ( | |
@model_year SMALLINT, -- parâmetro de entrada | |
@product_count INT OUTPUT -- parâmetro de saída | |
) AS | |
BEGIN | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- lista os produtos ordenados pelo preço | |
CREATE PROCEDURE uspFindProducts | |
AS | |
BEGIN | |
SELECT | |
product_name, | |
list_price | |
FROM | |
production.products | |
ORDER BY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
product_name, | |
list_price | |
FROM | |
production.products | |
ORDER BY | |
product_name; | |
CREATE PROCEDURE uspProductList | |
AS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-size: 16px; | |
color: #fff; | |
background-color: #61122f; | |
font-family: 'Oxygen', sans-serif; | |
} | |
#header-nav { | |
background-color: #f6b319; | |
border: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="pt-br"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>David Chu's Bistrô Chinês</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" | |
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<link rel="stylesheet" href="css/styles.css"> |