console (of all trades).. do you know any sql?
anyone know how to use isql*plus?specifically, how to enter in data and execute it to display results. I can create a table, but try and execute it and get nothing, unless I'm doing it wrong, been following the tutorial at http://www.oracle.com/technology/obe/obe9ir2/obe-mng/isqlplus/isqlplus.htmconsole (of all trades).. do you know any sql?
CREATE TABLE Student(studentid INT,firstname CHAR(20),lastname CHAR(20),grade CHAR(1),dept CHAR(25),DOB DATE,fine REAL,PRIMARY KEY(firstname);CREATE TABLE Book(isbn INT,title CHAR(20),author CHAR(20),edition INT,bookyear DATE)CREATE TABLE Borrowed(studentid INT,isbn INT,borrowdate DATE,due DATE)
Anyone know the cmd to find out how many records there are of a specific person.Say you want to find out how many students have the first name mike.
Another question, say you want to find the person who has rented the most movies from the year 2000 to 2007.Do you perform a count first, then compare it and display results?
CREATE TABLE STUDENT(STUID INTEGER PRIMARY KEY,FNAME CHAR(20),LNAME CHAR(20),GRADE CHAR(2),DEPT CHAR(25),DOB CHAR(10),FINE REAL);-- Book tableCREATE TABLE BOOK(ISBN INTEGER PRIMARY KEY,TITLE CHAR(30),AUTHOR CHAR(20),EDITION CHAR(5),BOOKYR CHAR(4));-- Borrowed tableCREATE TABLE BORROWED(STUID INTEGER,ISBN INTEGER,BORROWDATE CHAR(10),DUE CHAR(10)PRIMARY KEY(STUID, ISBN, BORROWDATE));-- Sample data for STUDENTINSERT INTO STUDENT VALUES ('4567', 'Michael', 'Doe', 'C', 'English', '02/15/1982', '20.00')-- Sample data for BORROWEDINSERT INTO BORROWED VALUES ('4567', '3456345798', '10/05/2007', '11/05/2007')
Select LNAME, COUNT(LNAME) FROM BORROWED GROUP BY LNAME, DEPT HAVING COUNT(LNAME)=(SELECT MAX(A.CNT) FROM (SELECT COUNT(LNAME) AS CNT FROM STUDENT GROUP BY (LNAME, DEPT)) AS A);