Skip to content

Instantly share code, notes, and snippets.

View ArCiGo's full-sized avatar
🎯
Learning

Armando Cifuentes ArCiGo

🎯
Learning
View GitHub Profile
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace WordGame
{
class MainClass
{
AA
AAH
AAHED
AAHING
AAHS
AAL
AALII
AALIIS
AALS
AARDVARK
# 6.00x Problem Set 4A Template
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
# Modified by: Sarina Canelake <sarina>
#
import random
import string
IF NOT EXISTS(SELECT 1 FROM sys.tables WHERE name = 'table_name')
CREATE TABLE "table_name"(
"column 1" "data type for column 1" [column 1 constraint(s)],
"column 2" "data type for column 2" [column 2 constraint(s)],
...
[table constraint(s)]
);
GO
IF NOT EXISTS(SELECT 1 FROM sys.tables WHERE name = 'Customer')
CREATE TABLE Customer(
Id INT IDENTITY,
FirstName NVARCHAR(40) NOT NULL,
LastName NVARCHAR(40) NOT NULL,
City NVARCHAR(40) NULL,
Country NVARCHAR(40) NULL,
Phone NVARCHAR(20) NULL,
CONSTRAINT PK_CUSTOMER PRIMARY KEY(Id)
);
/** Adding constraint to an existing table **/
ALTER TABLE Customer ADD CONSTRAINT PK_ORDER PRIMARY KEY(Id);
GO
/** Adding constraint to an existing table **/
ALTER TABLE "Order" ADD CONSTRAINT FK_ORDER_REFERENCE_CUSTOMER FOREIGN KEY(CustomerId) REFERENCES Customer(Id);
GO
/** Adding constraint to an existing table **/
ALTER TABLE Customer ADD CONSTRAINT UQ_Customer_RFC UNIQUE(RFC);
GO
CREATE TABLE #tmpTable(
Name CHAR(30),
SeqId INT
);
GO
SELECT cust.Id,
cust.FirstName,
cust.LastName,
cust.Phone
INTO #tmpCustomers
FROM Customer cust
WHERE cust.City = 'Portland' OR cust.city = 'San Francisco';
GO