SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE users ( username VARCHAR(100), password VARCHAR(100), hash VARCHAR(255) ); INSERT INTO users(username, password, hash) VALUES ('evan', 'goodpassword', 'wodv0vnwejgf0844nfg8rfn'); INSERT INTO users(username, password, hash) VALUES ('mark', 'password', 'hwoenfoveb313jsojf'); INSERT INTO users(username, password, hash) VALUES ('mike', 'password1', 'hwoenf353463456gff'); CREATE TABLE customers ( customer VARCHAR(100), id INT ); INSERT INTO customers(customer, id) VALUES ('Toyota', 1); INSERT INTO customers(customer, id) VALUES ('Honda', 2); CREATE TABLE music ( [ID] INT NOT NULL IDENTITY(1,1), [ArtistName] VARCHAR(50) NOT NULL, [AlbumName] VARCHAR(50) NOT NULL, [ReleaseYear] INT NOT NULL, CONSTRAINT [PK_Music] PRIMARY KEY ([ID] ASC) ); INSERT INTO music(ArtistName, AlbumName, ReleaseYear) VALUES ('Beach Boys', 'Sunflower', 1970); INSERT INTO music(ArtistName, AlbumName, ReleaseYear) VALUES ('Beatles', 'Abbey Road', 1969); SELECT * FROM MUSIC WHERE ArtistName='Beatles'; SELECT * FROM MUSIC WHERE ArtistName='' SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME > 'music'; SELECT * FROM MUSIC WHERE ArtistName='Beatles' UNION select 2 AS ID, STRING_AGG(table_name, ' ') COLLATE Latin1_General_CI_AS AS ArtistName, '3' AS AlbumName, 2000 AS ReleaseYear from information_schema.tables WHERE TABLE_NAME > 'a'; SELECT * FROM MUSIC WHERE ArtistName='' UNION SELECT 50, STRING_AGG(username, ' ') COLLATE Latin1_General_CI_AS, '3', 2000 FROM users WHERE username > ' '; SELECT name, type_desc FROM sys.database_principals WHERE type IN ('S', 'U'); EXEC sp_addrolemember 'admin', 'guest'; SELECT dp.name AS UserName, dp.type_desc AS UserType, dr.name AS RoleName FROM sys.database_principals AS dp JOIN sys.database_role_members AS drm ON dp.principal_id = drm.member_principal_id JOIN sys.database_principals AS dr ON drm.role_principal_id = dr.principal_id WHERE dp.name = 'guest';

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear