Java SQL中的查询未生成结果

Java SQL中的查询未生成结果,java,sql,jdbc,Java,Sql,Jdbc,我试图解决这个问题: 查找所有精灵的视频,其中创建者是唯一的观众。基本上找到所有的视频,其中唯一的观众是创作者 PreparedStatement pstmt = connection.prepareStatement("Select videoName from videos video natural join accountInformation natural join viewerAccount where " + "viewerName

我试图解决这个问题: 查找所有精灵的视频,其中创建者是唯一的观众。基本上找到所有的视频,其中唯一的观众是创作者

    PreparedStatement pstmt = connection.prepareStatement("Select videoName from videos video natural join accountInformation natural join viewerAccount where " +
    "viewerName = creatorName and video.videoName not in (Select videoName from videos natural join accountInformation natural join viewerAccount v where " +
    "video.creatorName != v.viewerName);");

    ResultSet resultSet = pstmt.executeQuery();
但是,我的查询从未产生结果。 有什么方法可以让我做得不一样吗?我觉得我的想法是对的,但我只是现在被卡住了。请参阅下表:

    String viewerAccount = "create table viewerAccount ("
    + " viewerName CHAR(100),"
    + " accountID integer,"
    + " primary key(viewerName),"
    + " foreign key (accountID) references accounts)";

    connection.createStatement().executeUpdate(viewerAccount);


    String videos = "create table videos "
    + "(link CHAR(50),"
    + " creatorName VARCHAR(100),"
    + " videoName VARCHAR(100),"
    + " duration integer,"
    + " primary key(link))";

    connection.createStatement().executeUpdate(videos);


    String accountInfo = "create table accountInformation ("
    + " accountID integer,"
    + " time integer,"
    + " link CHAR(50),"
    + " primary key(accountID,time,link),"
    + " foreign key (accountID) references accounts,"
    + " foreign key (link) references videos)";

    connection.createStatement().executeUpdate(accountInfo);

这是什么RDBMS?添加一些示例数据,并显示您期望的结果+当前结果。我把这把DB小提琴放在一起,如果你没有其他东西,你可以从那里开始(看起来它已经开始工作了)。顺便说一句,自然连接是一种简单的方法,可以使理解查询所做的事情花费比实际需要更长的时间。也不清楚您是否打算在子查询中过滤
视频.creatorName
,而不是
视频.subquery
,但在我的示例中,它没有改变任何内容。它不适用于我的数据库。我的表格包含很多行(可能1000+)。请帮助我们帮助您,共享一些示例数据,包括与您的解决方案不兼容的数据。请给我您的电子邮件好吗?所以我可以把文本文件发给你