• Tidak ada hasil yang ditemukan

Java Week 11 : Q3 - Nptel

N/A
N/A
Protected

Academic year: 2024

Membagikan "Java Week 11 : Q3 - Nptel"

Copied!
3
0
0

Teks penuh

(1)

02/07/2020 Programming in Java - Course

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=183 1/3

Due on 2020-04-20, 23:59 IST

Java Week 11 : Q3

Write the appropriate code in order to delete the following data in the table

PLAYERS.

Column UID First_Name Last_Name Age

Delete 1 Rama Gopala 24

Sample Test Cases

Input Output

Test Case 1 2 John Mayer 22

Test Case 2 2 John Mayer 22

The due date for submitting this assignment has passed.

As per our records you have not submitted this assignment.

Sample solutions (Provided by instructor) X

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming in Java (course)

(https://swayam.gov.in)

(https://swayam.gov.in/nc_details/NPTEL)

[email protected]

Announcements (announcements)

About the Course (https://swayam.gov.in/nd1_noc20_cs08/preview) Ask a Question (forum) Progress (student/home) Mentor (student/mentor)

Course outline

How does an NPTEL online course work?

Week 0 : Week 1 : Week 2 : Week 3 : Week 4 : Week 5 : Week 6 : Week 7 : Week 8 : Week 9 : Week 10 : Week 11 :

import java.sql.*;

import java.lang.*;

public class DeleteData {

public static void main(String args[]) { try {

Connection conn = null;

Statement stmt = null;

String DB_URL = "jdbc:sqlite:/tempfs/db";

System.setProperty("org.sqlite.tmpdir", "/tempfs");

String query="";

// Open a connection

conn = DriverManager.getConnection(DB_URL);

stmt = conn.createStatement();

String CREATE_TABLE_SQL="CREATE TABLE players ( UID INT, first_name VAR stmt.executeUpdate(CREATE_TABLE_SQL);

query = " insert into Players (UID, first_name, last_name, PreparedStatement preparedStmt = conn.prepareStatement(quer preparedStmt.setInt (1, 1);

preparedStmt.setString (2, "Rama");

preparedStmt.setString (3, "Gopala");

preparedStmt.setInt(4, 24);

12 34 56 78 109 1112 1314 1516 1718 1920 2122

(2)

02/07/2020 Programming in Java - Course

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=183 2/3

Week 12 : DOWNLOAD VIDEOS

Lecture 51 : JDBC—II (unit?

unit=12&lesson=65) Lecture 52 : JDBC—III (unit?

unit=12&lesson=66) Lecture 53 : Demonstration

—XX (unit?

unit=12&lesson=67) Lecture 54 : Demonstration

—XXI (unit?

unit=12&lesson=68) Lecture 55 : Demonstration

—XXII (unit?

unit=12&lesson=69) Quiz :

Assignment 11 (assessment?

name=186) Java Week 11 : Q1

(/noc20_cs08/progassignment?

name=181) Java Week 11:

Q2

(/noc20_cs08/progassignment?

name=182) Java Week 11 : Q3

(/noc20_cs08/progassignment?

name=183) Java Week 11 : Q4

(/noc20_cs08/progassignment?

name=184) Java Week 11 : Q5

(/noc20_cs08/progassignment?

name=185) Feedback For Week 11 (unit?

unit=12&lesson=196)

p p

preparedStmt.execute();

preparedStmt.setInt (1, 2);

preparedStmt.setString (2, "John");

preparedStmt.setString (3, "Mayer");

preparedStmt.setInt(4, 22);

preparedStmt.execute();

// Execute the command to delete a row form the table

stmt.executeUpdate("DELETE FROM Players WHERE UID = 1;");

ResultSet rs = stmt.executeQuery("SELECT * FROM players;");

while(rs.next())

System.out.println(rs.getInt(1)+" "+rs.getString(2)+"

conn.close();

}

catch(Exception e){ System.out.println(e);}

} } 2324 2526 2728 2930 3132 3334 3536 3738 39

(3)

02/07/2020 Programming in Java - Course

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=183 3/3

Assignment Solution Books

Live Interactive Session

Referensi

Dokumen terkait