You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.5 KiB
MySQL
102 lines
2.5 KiB
MySQL
4 years ago
|
CREATE DATABASE IF NOT EXISTS dmcdynamics;
|
||
|
CREATE USER 'dmcdynamics'@'localhost' IDENTIFIED BY 'Iu5I03ZDYjtYtqfD';
|
||
|
GRANT ALL ON dmcdynamics.* TO 'dmcdynamics'@'localhost';
|
||
|
FLUSH PRIVILEGES;
|
||
|
|
||
|
CREATE TABLE `companyinfo` (
|
||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||
|
`CompanyName` varchar(255) NOT NULL,
|
||
|
`PhoneNumber` varchar(20) NOT NULL,
|
||
|
`EmailAddress` varchar(100) NOT NULL,
|
||
|
`Address` varchar(255) NOT NULL,
|
||
|
`CompanySlogan` varchar(255) DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`)
|
||
|
) ;
|
||
|
|
||
|
INSERT INTO `CompanyInfo`
|
||
|
(
|
||
|
CompanyName,
|
||
|
PhoneNumber,
|
||
|
EmailAddress,
|
||
|
Address
|
||
|
)
|
||
|
VALUES
|
||
|
(
|
||
|
'DMC Dynamics LLC',
|
||
|
'(224) 241-2285',
|
||
|
'jobs@dmcdynamics.llc',
|
||
|
'4600 Sycamore Ln, Rolling Meadows, IL 60008'
|
||
|
);
|
||
|
|
||
|
DROP PROCEDURE IF EXISTS dmcdynamics.GetCompanyInfo;
|
||
|
|
||
|
DELIMITER $$
|
||
|
$$
|
||
|
CREATE PROCEDURE dmcdynamics.GetCompanyInfo()
|
||
|
begin
|
||
|
SELECT CompanyName,
|
||
|
PhoneNumber,
|
||
|
EmailAddress,
|
||
|
Address,
|
||
|
CompanySlogan
|
||
|
FROM `CompanyInfo`
|
||
|
LIMIT 1;
|
||
|
END$$
|
||
|
DELIMITER ;
|
||
|
|
||
|
|
||
|
CREATE TABLE `services` (
|
||
|
`ServiceID` int NOT NULL AUTO_INCREMENT,
|
||
|
`ServiceName` varchar(255) NOT NULL,
|
||
|
`ServiceTags` varchar(255) NULL,
|
||
|
`FontAwesomeIcon` varchar(50) NOT NULL,
|
||
|
`IsEnabled` bit(1) NOT NULL DEFAULT b'1',
|
||
|
PRIMARY KEY (`ServiceID`)
|
||
|
);
|
||
|
|
||
|
INSERT INTO `Services` (ServiceName) VALUES ('Software Development');
|
||
|
INSERT INTO `Services` (ServiceName) VALUES ('Web Design & Hosting');
|
||
|
INSERT INTO `Services` (ServiceName) VALUES ('Custom Computers');
|
||
|
INSERT INTO `Services` (ServiceName) VALUES ('Resume Services');
|
||
|
INSERT INTO `Services` (ServiceName) VALUES ('VHS to DVD Conversion');
|
||
|
INSERT INTO `Services` (ServiceName) VALUES ('Tech Consulting');
|
||
|
|
||
|
DROP PROCEDURE IF EXISTS dmcdynamics.GetServices;
|
||
|
|
||
|
DELIMITER $$
|
||
|
$$
|
||
|
CREATE PROCEDURE dmcdynamics.GetServices()
|
||
|
begin
|
||
|
SELECT ServiceID,
|
||
|
ServiceName,
|
||
|
ServiceTags,
|
||
|
FontAwesomeIcon,
|
||
|
IsEnabled
|
||
|
FROM `Services`
|
||
|
WHERE IsEnabled = 1;
|
||
|
END$$
|
||
|
DELIMITER ;
|
||
|
|
||
|
CREATE TABLE dmcdynamics.`service-information` (
|
||
|
ServiceInformationID INT auto_increment NOT NULL,
|
||
|
ServiceID INT NOT NULL,
|
||
|
ServiceDescription varchar(1000) NOT NULL,
|
||
|
CONSTRAINT service_information_pk PRIMARY KEY (ServiceInformationID),
|
||
|
CONSTRAINT service_information_ServiceID_FK FOREIGN KEY (ServiceID) REFERENCES dmcdynamics.services(ServiceID)
|
||
|
)
|
||
|
|
||
|
DROP PROCEDURE IF EXISTS dmcdynamics.ServiceInformation_SelectOne;
|
||
|
|
||
|
DELIMITER $$
|
||
|
$$
|
||
|
CREATE PROCEDURE dmcdynamics.ServiceInformation_SelectOne(
|
||
|
IN ID INT
|
||
|
)
|
||
|
BEGIN
|
||
|
SELECT ServiceInformationID,
|
||
|
ServiceID,
|
||
|
ServiceDescription
|
||
|
FROM `dmcdynamics`.`service-information`
|
||
|
WHERE ServiceID = ID;
|
||
|
END$$
|
||
|
DELIMITER ;
|