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
-- Grants access to all databases and tables to the role "dba" | |
GRANT ALL ON *.* TO 'dba'; | |
-- Grants access to the database "app" to the role "readonly" | |
GRANT SELECT ON app.* TO 'readonly'; | |
-- Grants access to the database "app" to the role "datawrite" | |
GRANT INSERT, UPDATE, DELETE ON app.* TO 'app_write'; | |
-- Grants access to developers |
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
WITH RECURSIVE fizz_buzz (sequence, modulo_3, modulo_5) AS ( | |
SELECT 1, CAST('' AS CHAR(4)), CAST('' AS CHAR(5)) | |
UNION ALL | |
SELECT sequence + 1, | |
IF(MOD(sequence + 1, 3) = 0, 'Fizz', ''), | |
IF(MOD(sequence + 1, 5) = 0, 'Buzz', '') | |
FROM fizz_buzz | |
WHERE sequence < 100 | |
) |
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
WITH RECURSIVE traversed (id, name, path, `left`, `right`) AS ( | |
SELECT id, | |
name, | |
CAST(JSON_ARRAY(id) AS JSON), | |
`left`, | |
`right` | |
FROM binary_tree | |
WHERE id = 1 | |
UNION | |
SELECT b.id, |
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
CREATE DATABASE `store` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; | |
USE store; | |
CREATE TABLE `users` ( | |
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, | |
`first_name` varchar(127) NOT NULL, | |
`last_name` varchar(128) NOT NULL, | |
`email` varchar(255) NOT NULL, | |
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
WITH RECURSIVE fibonacci(recursion_level, fibonacci_number, next_number) | |
AS ( | |
# Base Case | |
SELECT 0 AS recursion_level, | |
0 AS fibonacci_number, | |
1 AS next_number | |
UNION ALL | |
# Recursion query | |
SELECT recursion_level + 1 AS recursion_level, | |
next_number AS fibonacci_number, |
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 blog; | |
-- Count posts id | |
SELECT COUNT(DISTINCT id) FROM posts; | |
-- => 7 | |
-- count posts id | |
SELECT COUNT(DISTINCT post_id) from comments; | |
-- => 3 |
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
if settings.has_key?('services') | |
settings['services'].each do |service| | |
service['enabled'].each do |enable_service| | |
config.vm.provision "shell", inline: "sudo systemctl enable #{enable_service}" | |
end if service.include?('enabled') | |
service['disabled'].each do |disable_service| | |
config.vm.provision "shell", inline: "sudo systemctl disable #{disable_service}" | |
end if service.include?('disabled') | |
end |
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
# Snippet | |
# Enable Services | |
if settings.has_key?('services') | |
settings['services'].each do |service| | |
if service.include?('enabled') | |
enable = service['enabled'] | |
enable.each do |enable_service| | |
config.vm.provision "shell", inline: "sudo systemctl enable #{enable_service}" | |
end | |
end |
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
FROM composer:latest as composer | |
COPY src /var/www/html | |
WORKDIR /var/www/html | |
ENV COMPOSER_ALLOW_SUPERUSER 1 | |
RUN composer install && composer dump-autoload | |
RUN composer require google/cloud-language |
NewerOlder