草庐IT

table_entry

全部标签

php - MYSQL insert or update if exists on one-way composite primary key table 单向复合主键表

我有一个用户之间的友谊表,如下所示。CREATETABLEuser_relations(pkUser1INTEGERUNSIGNEDNOTNULL,pkUser2INTEGERUNSIGNEDNOTNULL,pkRelationsTypeTINYINTUNSIGNEDNOTNULL,PRIMARYKEY(pkUser1,pkUser2),FOREIGNKEY(pkuser1)referencesusers(ID),FOREIGNKEY(pkuser2)referencesusers(ID),FOREIGNKEY(pkRelationsType)referencesuser_relati

java - com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException : Duplicate entry '' for key 'PRIMARY'

我从今天开始得到这个异常(exception)。昨天一切都很好。我将发布我的代码:publicvoidenterStaff()throwsClassNotFoundException,SQLException{try{Class.forName("com.mysql.jdbc.Driver");connect=DriverManager.getConnection("jdbc:mysql://localhost:3306/project?"+"user=root&password=virus");statement=connect.createStatement();preparedS

mysql - 配置单元 'cannot alter table' 错误

当我将数据加载到表格时出现错误,感谢您的帮助。hive>loaddatalocalinpath'/home/Xperttech/Desktop/datagen_10.txt'intotablepatient;Copyingdatafromfile:/home/Xperttech/Desktop/datagen_10.txtCopyingfile:file:/home/Xperttech/Desktop/datagen_10.txtLoadingdatatotabledefault.patientFailedwithexceptionUnabletoaltertable.FAILED:E

mysql - 错误 1062 (23000) : Duplicate entry for key 'PRIMARY'

我正在尝试向sql表中添加一个新列-ALTERTABLEtable1ADDCOLUMNcolumn1VARCHAR(400)DEFAULTNULL;但是我收到了这个错误-ERROR1062(23000):Duplicateentry'82133627'forkey'PRIMARY'在表1中,我们只有一个主键,我运行了以下命令以查看结果-select*fromtable1where='82133627';集合中有1行Primarykey-primary_key_fieldint(11)NOTNULL此外,我浏览了一些针对类似错误的回复,他们建议检查主键是否具有自动递增功能。我们这张表只有

mysql - 创建从 from-to-entries 的时间序列

我有一些周期数据,如下所示:PNameDtFromDtToAmountPeriod_12018-01-012018-01-10100Period_22018-01-032018-01-0810Period_32018-01-052018-01-121我想获得以下时间序列,添加每个期间日期范围内的金额:2018-01-011002018-01-021002018-01-031102018-01-041102018-01-051112018-01-061112018-01-071112018-01-081112018-01-091012018-01-101012018-01-1112018

c# - MySql.Data.MySqlClient.MySqlException (0x80004005) : SELECT command denied to user 'XXX' @'YYY' for table 'bogus_table'

我正在使用Dapper调用MySql存储过程。该过程执行得很好,但之后代码抛出异常。有问题的代码块是这样的:using(varconn=DataFactory.InitializeConnection(false)){conn.Query("ProcedureName",new{puserid=ID},commandType:System.Data.CommandType.StoredProcedure);}在哪里DataFactory是以下静态类:publicstaticclassDataFactory{publicstaticIDbConnectionInitializeConne

mysql - 如何为单个 MySQL 数据库启用 STRICT_ALL_TABLES'?

有没有办法为单个MySQL数据库启用STRICT_ALL_TABLES? 最佳答案 设置sql_mode='STRICT_ALL_TABLES';会做的。 关于mysql-如何为单个MySQL数据库启用STRICT_ALL_TABLES'?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/164914/

php - 你怎么写“Select (all) From (table) Where posting=$posting except this posting?(Mysql)

我想编写一个Mysql语句,从表(发布)中选择所有内容,其中标题类似于$title除了$title的标题。基本上我想显示某个帖子的所有相关帖子。我希望查询选择表中标题或详细信息中具有标题名称的所有帖子。但我不希望该帖子显示在相关帖子中。//pseudocode$query="Select*FrompostingWheretitle,detail,like%$title%except$title";如何编写除外部分? 最佳答案 这是您需要的代码,但如果您有当前的帖子ID并且只有类似WHEREid!=".(int)$current_po

php - Kohana 3 ORM : How to get data from pivot table? 和与此相关的所有其他表

我正在尝试使用ORM访问存储在三个mysql表“users”、“items”和一个用于多对多关系的数据透视表中的数据:“user_item”我遵循了Kohana3.0.xORM:Readadditionalcolumnsinpivottables的指导尝试过$user=ORM::factory('user',1);$user->items->find_all();$user_item=ORM::factory('user_item',array('user_id'=>$user,'item_id'=>$user->items));if($user_item->loaded()){for

mysql select from multi tables 问题

这是查询SELECTmembers.memberID,members.salutation,members.firstName,members.middleName,members.lastName,members.suffix,members.company,addresses.address1,addresses.address2,addresses.city,addresses.state,addresses.postalCode,addresses.country,addresses.memberID,email.email,email.memberID,phonenumber