Name Min Max Tully $30,000.00 $45,000.00 Johnson $30,000.00 $45,000.00 Wolff $45,000.00 $60,000.00 Adams $45,000.00 $60,000.00 Smyth $60,000.00 $75,000.00
我们发现,获得这些表的查询形式如下所示
SELECT DISTINCTROW Employees.Name, SalaryRanges.Min, SalaryRanges.Max FROM Employees INNER JOIN SalaryRanges ON Employees.SalaryKey = SalaryRanges.SalaryKey ORDER BY SalaryRanges.Min;
DbObject DbO = new DbObject(new SqlServerConnectionFactory("localhost", 1433, "demo", "sa", "")); Connection con = DbO.getConnection(); //类代码(不含连接工厂实现) package skydev.modules.data;
public final class SqlServerConnectionFactory extends ConnectionFactory { private final String dbDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; private String host; private int port; private String databaseName;
public SqlServerConnectionFactory() { super.setDriverName(dbDriver); }
BIGINT BINARY BIT CHAR DATE DECIMAL DOUBLE FLOAT INTEGER LONGVARBINARY LONGVARCHAR NULL NUMERIC OTHER REAL SMALLINT TIME TIMESTAMP TINYINT VARBINARY VARCHAR
CREATE PROCEDURE [dbo].[sp_insertStudent](@name char(10),@age int,@id int OUTPUT) AS insert into Students([Name],[Age]) values (@name,@age) select @id=@@IDENTITY GO