From: BioWarehouse: a bioinformatics database warehouse toolkit
Example | SQL | Java |
---|---|---|
Create a new entry in the Protein table and add a comment for it in the CommentTable. | // Obtain a new WID SELECT WID_sequence.NextVal FROM dual INSERT INTO Protein (WID, Name, AASequence, DataSetWID) VALUES ('5', 'Sample Name', 'XXX', '2'); INSERT INTO CommentTable (OtherWID, Comm) VALUES ('5', 'Tester"s comment'); | // A new WID is automatically obtained by the Protein class Protein protein = new Protein (2); protein. setName("Sample Name"); protein. set AASequence("XXX"); protein. addComment ("Tester's comment"); protein. storeQ; |
Retrieve an existing entry in the Protein table and alter some of its data. | SELECT * FROM Protein WHERE WID = '5'; UPDATE Protein SET Name = 'New Name' WHERE WID = '5'; | Protein protein = new Protein (2, 5); protein. load(); protein. setName("New Name""); protein. update(); |
Delete the Protein entry. | DELETE FROM Protein WHERE WID = '5'; | Protein protein = new Protein (2, 5); Protein. delete (); |