Professional Documents
Culture Documents
Peña Roberick A00142090 Crea Una Base de Datos
Peña Roberick A00142090 Crea Una Base de Datos
Actividad a realizar
-- Create a database
USE master;
GO
CREATE DATABASE DemoDB2
ON
( NAME = DemoDB2_dat,
FILENAME = 'C:\Data\DemoDB2.mdf',
SIZE = 100MB, MAXSIZE = 500MB,
FILEGROWTH = 20%
)
LOG ON
( NAME = DemoDB2_log,
FILENAME = 'C:\Logs\DemoDB2.ldf',
SIZE = 20MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10MB
);
GO
USE master;
GO
USE AdventureWorks
GO
select * FROM HumanResources.Department
select * FROM HumanResources.Employee
select * FROM Sales.Store
select * FROM Person.Person
select 'FirstName' from Person.Person
select 'MiddleName' from Person.Person
select 'LastName' from Person.Person
select Firstname from Person.Person
select * FROM HumanResources.Department WHERE name='Pedro'
select * FROM HumanResources.Department WHERE Groupname='%R'
select * FROM HumanResources.Department WHERE Groupname='%R%'
select * FROM HumanResources.Department WHERE Groupname='R%'
select * FROM Person.Person Where FirstName='Ken' AND LastName='Sánchez'
select * FROM Person.Person WHERE LastName BETWEEN 'Duffy' AND 'Walters'
select * FROM Person.Person ORDER BY 'FirstName' DESC
select * FROM Person.Person ORDER BY 'LastName' DESC
select * FROM Person.Person ORDER BY 'MiddleName' DESC
INSERT INTO Person.Person VALUES ('Roberick','Pena')
INSERT INTO Person.Person VALUES ('Maria','Castillo')
INSERT INTO Person.Person (LastName) VALUES (Sayayin)
INSERT INTO Person.Person (FirstName) VALUES (Goku)
INSERT INTO HumanResources.Department (Name) VALUES (Yanikekero)
INSERT INTO HumanResources.Department(Name) VALUES (Portero)
INSERT INTO HumanResources.Department (Name) VALUES (Cocina)
INSERT INTO HumanResources.Employee (VacationHours) VALUES (98)
INSERT INTO HumanResources.Employee (JobTitle) VALUES (Barajista)
UPDATE Person.Person SET LastName='Sánchez'where LastName='Perez'
UPDATE Person.Person SET LastName='Erickson' where LastName='Goldberg'
UPDATE Person.Person SET LastName='Martinez' where LastName='White'
UPDATE Person.Person SET FirstName='Sam' where FirstName='Matt'
UPDATE HumanResources.Department SET Name='LimpiaBotas' where Name='Engeineering'
UPDATE HumanResources.Department SET GroupName='Vividor' where
GroupName='Research and Development'
UPDATE HumanResources.Employee SET MaritalStatus='Cogio' where MaritalStatus='M'
UPDATE HumanResources.Employee SET Gender='Chuki' where Gender='M'
UPDATE Sales.Store SET SalesPersonID='279' where SalesPersonID='278'
UPDATE Sales.Store SET SalesPersonID='277' where SalesPersonID='276'
DELETE FROM Person.Person Where LastName='Perez'
DELETE FROM Person.Person Where MiddleName='Daniel'
DELETE FROM Person.Person Where FirstName='Luis'
DELETE FROM HumanResources.Department Where Name='Marketing'
DELETE FROM Sales.Store Where Name='Riders Company'
DELETE FROM Sales.Store Where Name='The Bike Mechanics'
DELETE FROM HumanResources.Employee Where NationalIDNumber='295847284'
DELETE FROM HumanResources.Employee Where NationalIDNumber='245797967'
SELECT COUNT(*) FROM HumanResources.Department
SELECT COUNT(*) FROM HumanResources.Employee
SELECT COUNT(*) FROM Sales.Store
SELECT COUNT(*) FROM Person.Person
CREATE VIEW HumanResources.EmployeeHireDate
AS
SELECT p.FirstName, p.LastName, e.HireDate
FROM HumanResources.Employee AS e JOIN Person.Person AS p
ON e.BusinessEntityID = p.BusinessEntityID ;
GO
GO
execute saludar