263 lines
7.5 KiB
JSON
263 lines
7.5 KiB
JSON
{
|
|
"createt": {
|
|
"prefix": "createt",
|
|
"body": ["CREATE TABLE ${1:tableName} (", "\t${2:attribute(s)}", ");"],
|
|
"description": "Create regular table"
|
|
},
|
|
"createti": {
|
|
"prefix": "createti",
|
|
"body": [
|
|
"CREATE TABLE IF NOT EXISTS ${1:tableName} (",
|
|
"\t${2:attribute(s)}",
|
|
");"
|
|
],
|
|
"description": "Create table with conditional"
|
|
},
|
|
"created": {
|
|
"prefix": "created",
|
|
"body": ["CREATE DATABASE ${1:name};"],
|
|
"description": "Create regular table"
|
|
},
|
|
"createdi": {
|
|
"prefix": "createdi",
|
|
"body": ["CREATE DATABASE IF NOT EXISTS ${1:name};"],
|
|
"description": "Create table with conditional"
|
|
},
|
|
"insert": {
|
|
"prefix": "insert",
|
|
"body": [
|
|
"INSERT INTO ${1:tableName} (",
|
|
"\t${2:attribute(s)}",
|
|
") VALUES ( ${3:values} )"
|
|
],
|
|
"description": "Insert value(s)"
|
|
},
|
|
"dropt": {
|
|
"prefix": "dropt",
|
|
"body": ["DROP TABLE ${1:tableName};"],
|
|
"description": "Drop table"
|
|
},
|
|
"dropd": {
|
|
"prefix": "dropd",
|
|
"body": ["DROP DATABASE ${1:dbName};"],
|
|
"description": "Drop database"
|
|
},
|
|
"dropti": {
|
|
"prefix": "dropti",
|
|
"body": ["DROP TABLE IF EXISTS ${1:tableName};"],
|
|
"description": "Drop table with conditional"
|
|
},
|
|
"dropdi": {
|
|
"prefix": "dropdi",
|
|
"body": ["DROP DATABASE IF EXISTS ${1:dbName};"],
|
|
"description": "Drop database with conditional"
|
|
},
|
|
"showt": {
|
|
"prefix": "showt",
|
|
"body": ["SHOW TABLES;"],
|
|
"description": "Show tables"
|
|
},
|
|
"showd": {
|
|
"prefix": "showd",
|
|
"body": ["SHOW DATABASES;"],
|
|
"description": "Show databases"
|
|
},
|
|
"select": {
|
|
"prefix": "select",
|
|
"body": ["SELECT ${1:attribute(s)} FROM ${2:tableName};"],
|
|
"description": "Regular select"
|
|
},
|
|
"selectd": {
|
|
"prefix": "selectd",
|
|
"body": ["SELECT DISTINCT ${1:attribute(s)}", "\tFROM ${2:tableName};"],
|
|
"description": "Select Distinct"
|
|
},
|
|
"selectw": {
|
|
"prefix": "selectw",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tWHERE ${3:condition};"
|
|
],
|
|
"description": "Select with condition"
|
|
},
|
|
"selector": {
|
|
"prefix": "selector",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tORDER BY ${3:attribute(s)} ${4:ASC|DESC};"
|
|
],
|
|
"description": "Select with order"
|
|
},
|
|
"updatet": {
|
|
"prefix": "updatet",
|
|
"body": [
|
|
"UPDATE ${1:tableName}",
|
|
"\tSET ${2:attribute(s)}",
|
|
"\tWHERE ${3:condition};"
|
|
],
|
|
"description": "Update table"
|
|
},
|
|
"delete": {
|
|
"prefix": "delete",
|
|
"body": ["DELETE FROM ${1:tableName}", "\tWHERE ${3:condition};"],
|
|
"description": "Delete records"
|
|
},
|
|
"altert": {
|
|
"prefix": "altert",
|
|
"body": ["ALTER TABLE ${1:tableName}", "\t ${2:intructions};"],
|
|
"description": "Alter table"
|
|
},
|
|
"alterad": {
|
|
"prefix": "alterad",
|
|
"body": ["ALTER TABLE ${1:tableName}", "\tADD COLUMN ${2:col_name};"],
|
|
"description": "Alter table - Add column"
|
|
},
|
|
"alteraf": {
|
|
"prefix": "alteraf",
|
|
"body": [
|
|
"ALTER TABLE ${1:tableName}",
|
|
"\tADD COLUMN ${2:col_name}",
|
|
"\tAFTER ${5:col_name};"
|
|
],
|
|
"description": "Alter table - Add column after"
|
|
},
|
|
"alterdb": {
|
|
"prefix": "alterdb",
|
|
"body": [
|
|
"ALTER DATABASE ${1:dbName}",
|
|
"\tCHARACTER SET ${2:charset}",
|
|
"\tCOLLATE ${3:utf8_unicode_ci};"
|
|
],
|
|
"description": "Alter database"
|
|
},
|
|
"ijoin": {
|
|
"prefix": "ijoin",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tINNER JOIN ${3:tableName2}",
|
|
"\tON ${4:match};"
|
|
],
|
|
"description": "Inner Join"
|
|
},
|
|
"rjoin": {
|
|
"prefix": "rjoin",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tRIGHT JOIN ${3:tableName2}",
|
|
"\tON ${4:match};"
|
|
],
|
|
"description": "Right Join"
|
|
},
|
|
"ljoin": {
|
|
"prefix": "ljoin",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tLEFT JOIN ${3:tableName2}",
|
|
"\tON ${4:match};"
|
|
],
|
|
"description": "Left Join"
|
|
},
|
|
"fjoin": {
|
|
"prefix": "fjoin",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tFULL JOIN OUTER ${3:tableName2}",
|
|
"\tON ${4:match}",
|
|
"\tWHERE ${5:condition};"
|
|
],
|
|
"description": "Full Join"
|
|
},
|
|
"union": {
|
|
"prefix": "union",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)} FROM ${2:tableName}",
|
|
"UNION",
|
|
"SELECT ${3:attribute(s)} FROM ${4:tableName2};"
|
|
],
|
|
"description": "Regular union"
|
|
},
|
|
"uniona": {
|
|
"prefix": "uniona",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)} FROM ${2:tableName}",
|
|
"UNION ALL",
|
|
"SELECT ${3:attribute(s)} FROM ${4:tableName2};"
|
|
],
|
|
"description": "All union"
|
|
},
|
|
"groupb": {
|
|
"prefix": "groupb",
|
|
"body": [
|
|
"SELECT ${1:attribute(s)}",
|
|
"\tFROM ${2:tableName}",
|
|
"\tGROUP BY ${3:attribute(s)};"
|
|
],
|
|
"description": "Group by"
|
|
},
|
|
"bakupd": {
|
|
"prefix": "bakupd",
|
|
"body": ["BACKUP DATABASE ${1:dbName}", "\tTO DISK ${2:filepath};"],
|
|
"description": "Backup database"
|
|
},
|
|
"bakupdw": {
|
|
"prefix": "bakupdw",
|
|
"body": [
|
|
"BACKUP DATABASE ${1:dbName}",
|
|
"\tTO DISK ${2:filepath}",
|
|
"\tWITH ${3:DIFERENTIAL};"
|
|
],
|
|
"description": "Differential backup database"
|
|
},
|
|
"primaryk": {
|
|
"prefix": "primaryk",
|
|
"body": ["PRIMARY KEY(${1:attribute})"],
|
|
"description": "Primary Key"
|
|
},
|
|
"primarykc": {
|
|
"prefix": "primarykc",
|
|
"body": ["CONSTRAINT ${1:attribute} PRIMARY KEY(${2:attribute(s)})"],
|
|
"description": "Constraint Primary Key"
|
|
},
|
|
"foreingk": {
|
|
"prefix": "foreingk",
|
|
"body": [
|
|
"FOREIGN KEY(${1:attribute}) REFERENCES ${2:tableName}(${3:attribute})"
|
|
],
|
|
"description": "Foreign Key"
|
|
},
|
|
"foreingkc": {
|
|
"prefix": "foreingkc",
|
|
"body": [
|
|
"CONSTRAINT ${1:attribute} FOREIGN KEY (${2:attribute(s)})",
|
|
"\tREFERENCES ${3:tableName}(${4:attribute})"
|
|
],
|
|
"description": "Constraint foreign Key"
|
|
},
|
|
"check": {
|
|
"prefix": "check",
|
|
"body": ["CHECK ( ${1:condition} )"],
|
|
"description": "Check"
|
|
},
|
|
"creteuser": {
|
|
"prefix": "createuser",
|
|
"body": "CREATE USER '${1:username}'@'${2:localhost}' IDENTIFIED BY '${3:password}';",
|
|
"description": "Create User"
|
|
},
|
|
"deleteuser": {
|
|
"prefix": "deleteuser",
|
|
"body": "DELETE FROM mysql.user WHERE user = '${1:userName}';",
|
|
"description": "Delete user"
|
|
},
|
|
"grantuser": {
|
|
"prefix": "grantuser",
|
|
"body": "GRANT ALL PRIVILEGES ON ${1:db}.${2:tb} TO '${3:user_name}'@'${4:localhost}';",
|
|
"description": "Grant privileges"
|
|
}
|
|
}
|