package com.sf.jdbc.j20250906;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

/**
 * @author WanJl
 * @version 1.0
 * @title Account_Delete
 * @description
 * @create 2025/9/6
 */
public class Account_Delete {
    private static String url="jdbc:mysql://127.0.0.1:3306/db03";
    private static String username="root";
    private static String password="123456";

    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.cj.jdbc.Driver");

        Connection conn = DriverManager.getConnection(url, username, password);

        Statement stat = conn.createStatement();

        String sql="DELETE from account WHERE id=1";
        //因为是删除数据DELETE。所以使用executeUpdate()方法。
        int count = stat.executeUpdate(sql);

        System.out.printf("删除了%d条记录\n",count);


    }
}
