Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE Student(Std_no int, StdName TEXT, StdDegree TEXT, CourseName TEXT); INSERT INTO Student(StdName, StdDegree, CourseName) VALUES ('test1','att1','val1'), ('test1','att2','val2'), ('test1','att3','val3'), ('test1','att4','val4'), ('test2','att1','val5'), ('test2','att2','val6'), ('test2','att3','val7'), ('test2','att4','val8'); Select * from Student; SELECT * FROM crosstab( 'select StdName, StdDegree, CourseName from Student where StdDegree = 'att2' or StdDegree = 'att3' order by 1,2') AS Student(row_name text, category_1 text, category_2 text, category_3 text);

Stuck with a problem? Got Error? Ask AI support!

Copy Clear