-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdb_routines
More file actions
14 lines (8 loc) · 831 Bytes
/
db_routines
File metadata and controls
14 lines (8 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SET PASSWORD = PASSWORD('trolololol');
CREATE USER 'lmc'@'localhost' IDENTIFIED BY 'trolololol';
CREATE DATABASE methods_count;
GRANT ALL PRIVILEGES ON methods_count.* TO 'lmc'@'localhost';
CREATE TABLE libraries (id INTEGER NOT NULL AUTO_INCREMENT, fqn VARCHAR(255) NOT NULL, group_id VARCHAR(255) NOT NULL, artifact_id VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, count INTEGER DEFAULT 0, size INTEGER DEFAULT 0, PRIMARY KEY (id));
CREATE TABLE dependencies (library_id INTEGER NOT NULL, dependency_id INTEGER NOT NULL);
INSERT INTO libraries (fqn, group_id, artifact_id, version, count) VALUES ("com.github.dextorer:sofa:1.0.0", "com.github.dextorer", "sofa", "1.0.0", 817);
SELECT * FROM libraries WHERE id = ANY (SELECT dependency_id FROM libraries JOIN dependencies ON libraries.id = dependencies.library_id);