-
20210707web 作业
2021-07-08 22:29package com.demo; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class fliggyDemo { public static void inputElement(ChromeDriver driver, String eleName, String text) { WebElement element = driver.findElementByName(eleName); element.clear(); element.sendKeys(text); } public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("https://www.fliggy.com/"); Thread.sleep(2000); inputElement(driver,"depCityName","北京"); inputElement(driver,"depDate","2021-07-10"); driver.findElementByXPath("//span[text()='close']").click(); inputElement(driver,"arrCityName","长沙"); driver.findElementByXPath("//form[@id='J_FlightForm']//button").click(); Thread.sleep(5000); driver.quit(); } }
-
20210707web 作业
2021-07-07 19:54package com.demo; import org.openqa.selenium.chrome.ChromeDriver; import java.util.Set; public class demo { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("https://www.baidu.com/"); driver.findElementById("kw").sendKeys("测试派"); driver.findElementById("su").click(); Thread.sleep(1000); driver.findElementByPartialLinkText("软件测试工程师的心灵社区").click(); Thread.sleep(1000); String search_handle = driver.getWindowHandle(); Set<String> handles = driver.getWindowHandles(); for (String handle : handles) { if (!handle.equals(search_handle)) { driver.switchTo().window(handle); Thread.sleep(1000); driver.findElementById("navLogin").click(); Thread.sleep(1000); driver.findElementById("nameOrEmail").sendKeys("ke2beck"); driver.findElementById("loginPassword").sendKeys("********"); driver.findElementById("loginBtn").click(); Thread.sleep(1000); driver.findElementByXPath("/html/body/header/nav/a[2]").click(); Thread.sleep(5000); driver.close(); } } driver.quit(); } } ``` ```
-
20200327 连接子查询作业
2020-07-24 10:57#1.列出至少有三个员工的所有部门和部门信息。 SELECT dept.* from dept WHERE dept.DEPTNO IN (SELECT DEPTNO from emp GROUP BY emp.DEPTNO HAVING COUNT(emp.DEPTNO)>=3); #2.列出受雇日期早于直接上级的所有员工的编号,姓名,部门名称 SELECT e1.EMPNO, e1.ENAME,d.DNAME FROM emp e1,dept d WHERE e1.HIREDATE < (SELECT e2.HIREDATE FROM emp e2 WHERE e2.empno=e1.MGR) AND d.DEPTNO=e1.DEPTNO; #3.列出职位为“CLERK”的姓名和部门名称,部门人数 SELECT emp_name,dept_name,emp_num FROM ( SELECT emp.ENAME emp_name, dept.DNAME dept_name, (SELECT COUNT(emp.EMPNO) FROM emp WHERE emp.DEPTNO=dept.DEPTNO) emp_num FROM emp,dept WHERE emp.JOB='CLERK' AND emp.DEPTNO=dept.DEPTNO ) as t
-
20200326 连接子查询作业
2020-07-24 10:57#用一条sql语句查询每门课成绩都大于80分的学生 -- 分组查询 SELECT sname,MIN(score) 最小成绩 FROM tb_lemon_score GROUP BY sname HAVING MIN(score > 80); -- 非关联子查询 SELECT * FROM tb_lemon_score WHERE sname NOT IN (SELECT sname FROM tb_lemon_score WHERE score <= 80); -- 关联子查询 SELECT * FROM tb_lemon_score t1 WHERE NOT EXISTS (SELECT * FROM tb_lemon_score t2 WHERE t1.sname=t2.sname and t2.score<=80); #用sql语句查询所有购入商品为两种或两种以上的购物人 -- 非关联子查询 SELECT sname FROM (SELECT sname,COUNT(merch) FROM shopping_list GROUP BY sname HAVING COUNT(merch)>=2) as list; -- 关联子查询 SELECT DISTINCT sname FROM shopping_list s1 WHERE EXISTS (SELECT * FROM shopping_list s2 WHERE s2.sname=s1.sname GROUP BY s2.sname HAVING COUNT(s2.merch)>=2)
-
20200325 数据库连接查询面试题作业
2020-07-24 10:57#6 查询出语文最高分 SELECT c.Cno,c.Cname,MAX(sc.score) FROM sc INNER JOIN course c ON c.Cno = sc.Cno WHERE c.Cname = '语文'; #8 查询语数外三门成绩的平均分 SELECT c.Cname,AVG(sc.score) FROM sc INNER JOIN course c ON c.Cno = sc.Cno GROUP BY c.Cname; #9 查询报名孤独求败老师课程的学生信息 SELECT s.* FROM teacher t INNER JOIN course c ON c.Tno = t.Tno AND t.Tname = '孤独求败' INNER JOIN sc ON sc.Cno = c.Cno INNER JOIN student s ON s.Sno = sc.Sno